Skip to main content

Check if column exists in MSSQL

if exists(select * from sys.columns 
            where Name = N'columnName' and Object_ID = Object_ID(N'tableName'))
begin
    -- Column Exists
end
 
 
The following does not look in fields 
 
select * from sys.all_objects
where name like '%[what you are looking for]%' 

Comments

Popular posts from this blog