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 |
|
diegoesp
Starting Member
3 Posts |
Posted - 2002-03-18 : 10:35:00
|
| Hi. I have a Store Procedure that does many things, and one of them is creating a query on the fly in a string. After executing that query, i want the resulting value being stored in a string. Something like this:SET sSQL='SELECT IDContent FROM Contents'SET @value = sp_executesql sSQLThe problem with the preceding code is that... it doesn't work!! is there some way that i can obtain a value from a previously formed query string? thanks |
|
|
Jay99
468 Posts |
Posted - 2002-03-18 : 10:39:53
|
use NorthWindgocreate table #tmpEmp (EmployeeID int)declare @sSQL nvarchar(100)set @sSQL = 'insert #tmpEmp select employeeid from employees'exec sp_executesql @sSQLselect * from #tmpEmpgodrop #tmpEmpgo Jay |
 |
|
|
diegoesp
Starting Member
3 Posts |
Posted - 2002-03-18 : 10:48:30
|
| Thank you very much!!! |
 |
|
|
|
|
|