Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    111

    Unanswered: Assign a single result set to a variable

    How do I properly code the following? Thanks!

    Code:
    DECLARE @MaxTeamPlayerNumber int 
    
    SET @MaxTeamPlayerNumber = SELECT MAX(dbo.TEAM.player_number) FROM dbo.TEAM

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    DECLARE @MaxTeamPlayerNumber		INT
    
    SELECT @MaxTeamPlayerNumber = Max(player_number)
       FROM dbo.TEAM
    -PatP

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    DECLARE @MaxTeamPlayerNumber int 
    
    SET @MaxTeamPlayerNumber = (SELECT MAX(dbo.TEAM.player_number) FROM dbo.TEAM)
    As SET is ANSI standard.
    George
    Home | Blog

Posting Permissions

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