Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving the top number results using a local variable 2

Status
Not open for further replies.

cplsplsprogrammer

Programmer
Apr 18, 2005
42
US
Hello all,

I am trying to write a stored procedure which takes in a number as input and retrieves the top number of results. I wrote the following code but it is not working. Can anyone please tell me what I am doing wrong or what is the correct procedure to write the statement.

Create Procedure records (@count int not null)
as
begin
select top @count id, type, evtime from customerTable
end
GO

Thanks.
 
Have a look at this thread thread183-1097236.

Sunil
 
Hey, that's a nifty solution!

Thanks, sunila7!



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top