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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure Errors

Status
Not open for further replies.

Yerdon

Programmer
Jul 29, 2002
62
US
Hi Everyone,

I want to be able to run a SQL statement such as:

samp c_orders

and it will return the top 10 rows of the "c_orders" table.

So I tried putting together what I thought would be a very simple stored procedure, but I cannot get it to work. I've tried everything I can think of with no luck. Can somebody help? Here's what I'm writing:

*************************************

CREATE procedure [dbo].samp
@MyTable varchar(64)
as
select top 10 * from @MyTable
GO

*************************************

Any help would be greatly appreciated!

Joseph

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top