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 |
|
Gavin1977
Starting Member
16 Posts |
Posted - 2008-06-24 : 05:40:02
|
Hello all.Im trying to write a stored procedure which i can stipulate the top number of rows it returns. I know i use the following syntax: SELECT TOP 5 And i know i need to pass the number of rows i want as a variable to the stored proceudre like: @Top as Integer But when i try and do the following. SQL Server complains about the syntax:SELECT TOP @Top Can anyone advise me how i should be doing this? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-06-24 : 05:41:23
|
| [code]SELECT TOP (@Top)...[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Gavin1977
Starting Member
16 Posts |
Posted - 2008-06-24 : 05:46:30
|
| Ahh excellant, thanks very much. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-24 : 07:01:40
|
This information is also available in Books Online, the Microsoft SQL Server help file. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|