-
Select TOP @Variable
hey,
how can you make number of returned results from select statement a variable?
Such as
declare @variable as int
select @variable * from Table
cheers
vlad
-
Try this:
declare @rows int
set @rows = 5
set rowcount @rows
select * from YourTableName
-
forget one more think:
make sure after your select statement add a line:
...
...
select * from YourTableNmae
set rowcount 0
-
hi dim,
thank you for reply,
i just want to make clear one issue with using set rowcount - does it affect only current session? i mean if there are more connections open at the same time, would it affect others as well?
cheers
vlad
-
Yes, affect current session only.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|