|
-
Jul 26th, 2006, 05:30 AM
#1
Thread Starter
Member
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
-
Jul 26th, 2006, 05:44 AM
#2
Re: Store Procedure
This is a Database Development issue, not a VB.NET issue.
-
Jul 26th, 2006, 07:54 AM
#3
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|