I need to create a procedure which checks to see if a record exists in sql server and if it does, return some parameter so I can do further processing in VB.net.
Can anyone point me in the right direction ?
Printable View
I need to create a procedure which checks to see if a record exists in sql server and if it does, return some parameter so I can do further processing in VB.net.
Can anyone point me in the right direction ?
I use count if the count is 0 is doesn't exist if it's 1 it does
Crossposter!
Wasn't my answer good enough? :cry:
look it up in BOL
IF Exists(SELECT * FROM blah WHERE blah blah)
--do something if true you can use SELECT 1 as well
else
--do something else like an insert
INSERT INTO
blah (
col1,
col2
)
SELECT GetDate(), UDFFunc()