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 2000 Forums
 SQL Server Development (2000)
 Problem while passing varibale in From clause

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-23 : 09:23:58
SallyHudson writes "Hi,
Can't we pass a variable in the 'FROM' clause of the stored procedure ???? As if I give the table name instead of the variable then my StoredProcedure compiles without any error .....

I am passing a variable @table_name while creating a procedure, but In the From clause if I put that variable tehn the Stored Procedure doesnot execute and gives an error as :
"Line 9: Incorrect syntax near '@table_name'."


My Procedure is as follows.....

Create Procedure sp_getTableRecords

@table_name varchar(36) ,
@Page int,
@Size int

AS
SELECT * from @table_name


I will appreciate if someone can help me ....
Thanks!"
   

- Advertisement -