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 - 2003-06-03 : 08:29:21
|
| Karsten writes "Hi,why does this not work?declare @i intexec sp_executesql N'select count(*) from master.dbo.spt_values where type = ''C''', N'@i int output', @i output select @iI would like to get the result into the var @i, but I always just get null.What is the mistake?Thanks in advanceKarsten" |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-06-03 : 11:45:07
|
Why not just do :Declare @i intSelect @i = count(*) from master.dbo.spt_values where type='c'Select @i ?????DamianEdited by - merkin on 06/03/2003 11:45:57 |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-06-03 : 13:38:48
|
| But the problem with your code is that you aren't assigning the value to the variabledeclare @i int exec sp_executesql N'select @i = count(*) from master.dbo.spt_values where type = ''C''', N'@i int output', @i output select @iseehttp://www.nigelrivett.net/sp_executeSQL.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|