Thursday, May 8, 2014

How to find whether specific column exists in the given table.. in SQL 2008

-- Query to check the specific column is exists in the table in SQL 2008

if exists (select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='<Table_Name>' and COLUMN_NAME='<Column_Name>')
begin
print 'Column you have specified is exists'
end
else
begin
print 'Column does not exists'
end

No comments:

Post a Comment