Click to See Complete Forum and Search --> : Exists in SQL Server procedure
venerable bede
Sep 16th, 2004, 05:02 AM
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 ?
Magiaus
Sep 16th, 2004, 08:46 AM
I use count if the count is 0 is doesn't exist if it's 1 it does
mendhak
Sep 17th, 2004, 12:03 AM
Crossposter!
Wasn't my answer good enough? :cry:
jhermiz
Sep 17th, 2004, 12:51 PM
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()
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.