/ Published in: SQL
My Drop Column.sql
This template drops a columns of the table.
This template drops a columns of the table.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
--========================================================================== -- Drop column template -- -- This template drops a columns of the table -- -- Use the Specify Values for Template Parameters -- command (Ctrl-Shift-M) to fill in the parameter -- values below. --========================================================================== PRINT 'ALTER TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table> DROP <drop_column_name, sysname, sample_column>' GO IF EXISTS (SELECT * FROM dbo.syscolumns WHERE id = OBJECT_ID(N'<schema_name, sysname, dbo>.<table_name, sysname, sample_table>') AND name = N'<drop_column_name, sysname, sample_column>') BEGIN ALTER TABLE <schema_name, sysname, dbo>.<TABLE_NAME, sysname, sample_table> DROP COLUMN <drop_column_name, sysname, sample_column> END GO