Basically just stuff I run across and think I should save.
Pages
▼
Thursday, March 4, 2010
Column Exists before creating
I do not know why, but I have trouble remembering how to check if a SQL Server Column exists before trying to add it. Here it is:
IF NOT EXISTS (select * from syscolumns where id=object_id('[table_name]') and name='[column_name]')
alter table [table_name] add [column_name] [column_definition>]
No comments:
Post a Comment