| | |
|
Active Server Pages asp source code database MS SQL MS Access .mdb adovbs.inc cookies calendar codes sql commands scripts asp programming tutorials iis web server components CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
SQL Server - Stored procedure nightmare |
From: |
Tom Holder |
Date: |
2/6/2000 10:58:22 AM |
IP: |
193.149.90.244 |
Im trying to do something which I assume is very simple with a stored procedure. This is an example
pulled of the 4Guys web site to illustrate what I need to do:
CREATE PROCEDURE sp_myInsert
@FirstName varchar(20),
@LastName varchar(30),
@MyTableParam varchar(20)
As
INSERT INTO TableName(FirstName, LastName)
values(@FirstName, @LastName)
Go
Now this stored procedure is simple enough, even to me. However, rather than insert the values of
FirstName, and LastName into the table called TableName I need to insert them into the table
specified in the parameter @MyTableParam. I have tried doing the following (the obvious) but it
generates a syntax error.
CREATE PROCEDURE sp_myInsert
@FirstName varchar(20),
@LastName varchar(30),
@MyTableParam varchar(20)
As
INSERT INTO @MyTableParam(FirstName, LastName)
values(@FirstName, @LastName)
Go
Just out of interest, its actually a SELECT statement that I need to use this format in. |
|
|

|
|
|
|