Thursday, 7 March 2013

MS SQL - Check if column exists in table

Watch this example on YouTube:


if Exists(select * from sys.columns where Name = N'ColumnName' and Object_ID = Object_ID(N'TableName'))
begin
    Select * from TableName   
end

No comments:

Post a Comment