Write a simple coding for EXISTS keyword in sql server 2005?

Write a simple coding for EXISTS keyword in sql server 2005?

Here is the simple code for using EXISTS.



IF exists (SELECT fieldname FROM sampleTable WHERE condition)
begin
select * from sampleTable where Condition
print 'Record already Exists'
END

No comments: