-- 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
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