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 |
|
sqlbee
Starting Member
11 Posts |
Posted - 2004-02-11 : 15:10:53
|
| declare @count int exec ('set ''' + @count + ''' = count(*)from employee')select @count |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-02-11 : 15:22:46
|
| declare @sql nvarchar(1000)declare @count int select @sql = 'select @count = count(*)from employee'exec sp_executesql @sql, N'@count int out', @count outselect @count==========================================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. |
 |
|
|
sqlbee
Starting Member
11 Posts |
Posted - 2004-02-11 : 15:41:31
|
| thanks. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-02-11 : 15:52:14
|
| And you don't dodeclare @count int select @count = count(*)from employeeBecause?Brett8-) |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-02-12 : 00:38:38
|
Nr,In your SQL:declare @sql nvarchar(1000)declare @count int select @sql = 'select @count = count(*)from employee'exec sp_executesql @sql, N'@count int out', @count outselect @countWhat's the N' for? |
 |
|
|
JustinBigelow
SQL Gigolo
1157 Posts |
Posted - 2004-02-12 : 01:01:24
|
| N' indicates you are using nvarchar or nchar instead of varchar and char respectively for storing Unicode data.See Books On Line for more info.Justin"I want to thank you. You could've given us help, but you've given us so much more." |
 |
|
|
theGrimm
Starting Member
4 Posts |
Posted - 2004-02-13 : 02:48:18
|
quote: Originally posted by X002548 And you don't dodeclare @count int select @count = count(*)from employeeBecause?
Enlighten me. Please.theGrimm |
 |
|
|
|
|
|