Hi,
I have a table with the follwing values
Table Cats
{
CatID, date
--
Cat1, D1
Cat2, D2
Cat3, D3
}
I just wanted to check whether Cat1 exists in the table. Can anyone post the query
Thanks
~MOhan
EXISTS(SELECT 1 FROM YourTable WHERE CatID = 'Cat1')|||This query gives the following error
Incorrect syntax near the keyword 'EXISTS'.
Can you please give me the correct one
~Mohan
|||It worked..Thanks|||It was not a complete query.IF EXISTS(SELECT 1 FROM YourTable WHERE YourColumn = 'YourValue')
PRINT 'Exists'
ELSE
PRINT 'Not Exists'
Or
IF EXISTS(SELECT 1 FROM YourTable WHERE YourColumn = 'YourValue')
SELECT 'Exists'
ELSE
SELECT 'Not Exists'
No comments:
Post a Comment