Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: Seting 2 variables from 1 select statement

    is it possible to assign the results of the qry to the 2 variables?

    Declare @a Integer
    Declare @b Integer

    SELECT A, B from myTable

  2. #2
    Join Date
    Aug 2006
    Location
    San Francisco, CA
    Posts
    136
    Yes

    Code:
    Declare @a Integer
    Declare @b Integer
    
    select @a = dbid,@b = mode from master.dbo.sysdatabases where name = 'master'
    
    print @a
    print @b

Posting Permissions

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