Return to Snippet

Revision: 40459
at February 23, 2013 02:55 by edwinet


Updated Code
--==========================================================================
-- 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

Revision: 40458
at February 2, 2011 09:56 by edwinet


Initial Code
--==========================================================================
-- Drop column template
--
-- This template drops a columns of the table.
--==========================================================================

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

Initial URL

                                

Initial Description
My Drop Column.sql
This template drops a columns of the table.

Initial Title
SQL Template - Drop Column

Initial Tags
sql, table, template

Initial Language
SQL