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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 stored procedure gets passed numrecords

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-12-18 : 06:49:21
i have a stored procedure where i pass @numrecords which is the amount of records to return
but when i do

SELECT top @numrecords usernames from newusers

i get an error -what's the correct syntax?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-12-18 : 06:51:08
Are you using SQL Server 2005?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-18 : 06:53:30
SELECT top (@numrecords) usernames from newusers


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-12-18 : 06:56:18
thanks - another field in the table is called sent -
how can I when I select the x number of fields have that x number of fields marked as sent
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-18 : 06:59:13
[code]SELECT top (@numrecords) usernames from newusers
where sent = 1[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-18 : 07:16:05
quote:
Originally posted by esthera

thanks - another field in the table is called sent -
how can I when I select the x number of fields have that x number of fields marked as sent


I am really surprised that you didnt figure it out yourself

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -