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 |
|
nice123ej
Starting Member
48 Posts |
Posted - 2007-08-03 : 13:46:38
|
| what can work similar to this other than dynamic sql EXEC('....')?!DECLARE @MyVar intSET @MyVar = 7SELECT TOP @MyVar * FROM EMPLOYEES |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-03 : 13:50:05
|
| SELECT TOP(@MyVar) * FROM EMPLOYEES_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-03 : 13:51:06
|
You need to use brackets.SELECT TOP (@MyVar) * FROM EMPLOYEES Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-03 : 13:51:28
|
Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-08-10 : 08:05:59
|
| hmmmm7 days to give a wrong answer to an already (twice) answered question :).==========================================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. |
 |
|
|
|
|
|