I have a temparory table.temp table is created using select into statement.
Temp table columns are dynamically created .column numbers may vary.
For eg.
Temparory table
ID,Addrss1,Address2,Address3
ID, Address1,Address2,Address3,Address4,Address5.....
All temp columns have the First column as ID.I need to create a view with base table and temp table
I need to avoid the first column of the temporary table in the select statement of the view.I cannot take temp.*.it will take ID.I do not want ID in the select statement.
Any help appreciated
Right-click the column you want to delete and choose Delete Column from the shortcut menu. If the column participates in a relationship (FOREIGN KEY or PRIMARY KEY), a message prompts you to confirm the deletion of the selected columns and their relationships. Choose Yes.
Using the DROP TABLE command on a temporary table, as with any table, will delete the table and remove all data. In an SQL server, when you create a temporary table, you need to use the # in front of the name of the table when dropping it, as this indicates the temporary table.
Use the DELETE command to replace the value in a column with null or to remove an entire row of data. CQL provides the DELETE command to delete a column or row. Deleted values are removed completely by the first compaction following deletion.
Just try below script:
/* Get the data into a temp table */
SELECT * INTO #TempTable
FROM YourTable
/* Drop the cloumns that are not needed */
ALTER TABLE #TempTable
DROP COLUMN ColumnToDrop
/* Get results and drop temp table */
SELECT * FROM #TempTable
DROP TABLE #TempTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With