SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Houston
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to Determine if Query Returns Something?

    Sorry if this is incredibly obvious, but how do you determine if a select statement in a stored procedure returns anything? Here's a piece of code from a stored procedure I'm working on:
    Code:
    select @found = TeamID
    from results
    where TeamID in
    	(
    	select Week1 as 'TeamID'
    	from picks
    	where entryid = @entryid
    	)
    What is the easiest/standard way of determining if @found contains a record?

    BTW, I'm running SQL Server 2000.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    @@ROWCOUNT

    i've never used it myself

    say, thanks for the reminder, i have to get my own picks/weeks/spreads/players database up and running real quick

    i have the entire schedule in an excel sheet, if that helps


    rudy
    http://rudy.ca/

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Houston
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rudy-

    Yeah, I guess I can just use @@ROWCOUNT. I forgot about that.

    As for the schedule, I've already got one. Thanks.


Bookmarks

Posting Permissions

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