Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Posts
    91

    Unanswered: Getting the return value

    Hello everyone -

    Please advise on why the output value is an empty

    declare
    @DynamicSQL3 NVARCHAR(4000

    SET @DynamicSQL3 = 'SELECT Security_Level_ID ' +
    'FROM ' + @DatabaseName + '.dbo.Security_Level_Master ' +
    'WHERE Security_Level_Name = ''Administrator'' '

    exec sp_executesql @DynamicSQL3, N'@i int output', @AdministratorSecurityID output


    I run the query and see the grid being populated with the proper
    security_level_id in the query analyzer,

    but when i execute a print @AdministratorSecurityID
    there is a space character in the results window

    please advise on what i am doing wrong

    thanks
    tony

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    declare @DynamicSQL3 NVARCHAR(4000
    
    SET @DynamicSQL3 = 'SELECT @i = Security_Level_ID ' +
    'FROM ' + @DatabaseName + '.dbo.Security_Level_Master ' +
    'WHERE Security_Level_Name = ''Administrator'' '
    
    exec sp_executesql @DynamicSQL3, N'@i int output'
    ,  @AdministratorSecurityID output
    -PatP

  3. #3
    Join Date
    Oct 2004
    Posts
    91
    that was the issue - many thanks!!!

Posting Permissions

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