-
Store Procedure
Hi All,
I would like to create a store procedure in SQL with input parameter is table's name so that i just change name of table when execute select statement.
Ex : Create Procedure TestTable @sTable varchar(25)
as
Begin
select * from @sTable
End
But this syntax is not correct, Any advise?
Thanks so much,
Thanh Nguyen
-
Re: Store Procedure
This is a Database Development issue, not a VB.NET issue.
-
Re: Store Procedure
You cannot have a variable for a table name in a SELECT.
You can build that SELECT statement into a @SQL varchar() variable - then:
EXEC (@SQL)
But dynamic SQL certainly takes away the advantage of a STORED PROCEDURE.
Why are you doing this?