Using SELECT TOP with a variable
From: Tim (anonymous_at_discussions.microsoft.com)
Date: 03/08/04
- Next message: Tim: "RE: select range of dates"
- Previous message: Laura: "select range of dates"
- Next in thread: Rohtash Kapoor: "Re: Using SELECT TOP with a variable"
- Reply: Rohtash Kapoor: "Re: Using SELECT TOP with a variable"
- Reply: Vishal Parkar: "Re: Using SELECT TOP with a variable"
- Reply: Anith Sen: "Re: Using SELECT TOP with a variable"
- Reply: Tim: "RE: Using SELECT TOP with a variable"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Mar 2004 06:31:09 -0800
Using old T-SQL I can force a maximum number of rows that will be returned using SET ROWCOUNT n like this
DECLARE @num int
SET @num = 10
SET ROWCOUNT @num
SELECT * FROM authors
SET ROWCOUNT 0
Is there a way to use a varibale with TOP? The example below doesn't work but it shows what I'd like to do. Thank you in advance.
declare @num int
set @num = 10
select top @rw * from authors order by logon_id
Regards,
Tim
- Next message: Tim: "RE: select range of dates"
- Previous message: Laura: "select range of dates"
- Next in thread: Rohtash Kapoor: "Re: Using SELECT TOP with a variable"
- Reply: Rohtash Kapoor: "Re: Using SELECT TOP with a variable"
- Reply: Vishal Parkar: "Re: Using SELECT TOP with a variable"
- Reply: Anith Sen: "Re: Using SELECT TOP with a variable"
- Reply: Tim: "RE: Using SELECT TOP with a variable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|