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 |
|
bigwhacker
Starting Member
6 Posts |
Posted - 2004-08-18 : 12:38:08
|
| I need to perform the following - but ...@lastupdtime = exec ("SELECT LASTUPDDTTM FROM " + @DBName + "..PSSERVERSTAT WHERE SERVERNAME = 'PSNT'")How can I get a local variable assignment from dynamic sql? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-18 : 12:53:30
|
| you can't this way. you can write a stored procedure or use a global temp table (##temp)Go with the flow & have fun! Else fight the flow :) |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-18 : 13:15:22
|
| oh yeah i forgot: you can also do this:declare @stmt nvarchar(100)declare@lastupdtime intset @stmt = 'SELECT LASTUPDDTTM FROM " + @DBName + "..PSSERVERSTAT WHERE SERVERNAME = \'PSNT\''exec @lastupdtime = sp_executesql @stmtGo with the flow & have fun! Else fight the flow :) |
 |
|
|
|
|
|