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 |
|
GoodTogether
Starting Member
5 Posts |
Posted - 2007-11-07 : 11:56:27
|
Hi,How would I go about having a "SELECT TOP" stored procedure which returns a dynamic number of results based on a parameter to the stored procedure?Here is what I tried but the syntax is incorrect.CREATE PROCEDURE [dbo].[uspSelect_Something] @ItemCount intASSELECTTOP @ItemCount [COLUMN1], [COLUMN2]FROM [Table]ORDER BY [COLUMN2] ASC Thanks |
|
|
anonymous1
Posting Yak Master
185 Posts |
Posted - 2007-11-07 : 12:02:35
|
| TOP @ItemCountshould beTOP (@ItemCount) |
 |
|
|
GoodTogether
Starting Member
5 Posts |
Posted - 2007-11-07 : 12:07:57
|
| That's done the trick - thanks |
 |
|
|
|
|
|