0 Comments

SQL Server 2005 onwards:

if not exists(select 1 from sys.columns where Name = N’columnName’ and Object_ID = Object_ID(N’tableName’))
begin
   
— Column does not exist
end

http://stackoverflow.com/questions/133031/how-to-check-if-column-exists-in-sql-server-table

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts