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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-07-23 : 09:31:38
|
| Luca writes "I want to store the results of a dynamic query to a variable whitin a stored procedure , but I'm not able to do this using sp_executesql. ( I'm using sqlserver 7)For Example using Northwind database :declare @myfield varchar(20)declare @mysql nvarchar(100)declare @myresult varchar(100)set @myfield='CategoryName'set @mysql='select ' + @myfield + ' from Categories where categoryid= 1'set @myresult = execute sp_executesql @mysqlThe problem is I'm not able to store the result to @myresult.How I can do this ?Thank you" |
|
|
|
|
|