Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Get a value out of a sql string

Author  Topic 

Pumkin
Starting Member

20 Posts

Posted - 2005-08-22 : 07:54:51
Hello everyone.
I have this sql string
@sql='select'+@key +'From table' + char(10) + 'PRINT @key'
EXEC sp_executesql @sql

The value @key is correctly returned in the sql string
But the problem is I need it after I execute the SQLString.
If after execution I write another PRINT, the value is null.

How can I get the value to work with it in my procedure?

Thanks for your time.

Pumkin
Starting Member

20 Posts

Posted - 2005-08-22 : 08:24:15
Sorry..
I found how to solve my problem
EXEC sp_executesql @sql N'@Key as varchar(3) OUT' , @Key OUT
Thanks anyway
Go to Top of Page
   

- Advertisement -