Results 1 to 4 of 4

Thread: Exists in SQL Server procedure

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Exists in SQL Server procedure

    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 ?

    Parksie

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I use count if the count is 0 is doesn't exist if it's 1 it does
    Magiaus

    If I helped give me some points.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Crossposter!

    Wasn't my answer good enough?

  4. #4
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    Re: Exists in SQL Server procedure

    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()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width