Thursday, March 29, 2012

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
tonydeclare @.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|||that was the issue - many thanks!!!sql

No comments:

Post a Comment