declare @count int

Declare @table nvarchar (50)

declare @Column nvarchar (100)

set @table =‘checkcolumn’

set @Column =‘Salary’

set @count =(Select count(*) fromInformation_Schema.columns

where Table_name = @table and Column_name =@Column)

if (@count=1)

print ‘The Column Name ‘+‘ ( ‘+ @Column +  ‘ ) ‘+‘ Is already Exists in Table Name ‘+   ‘ ( ‘+ @table +  ‘ ) ‘

if (@count = 0)

print ‘The Column Name ‘+’ ( ‘+ @Column +  ‘ ) ‘+’ Is Not Exists in Table Name ‘+   ‘ ( ‘+ @table +  ‘ )

Leave a comment

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