I dont know if this is possible, but what I want to have is a stored procedure that I can pass the name of the column that I wish to be added to my table from my vb.net application.
example: from my vb.net app I would call the stored procedure and pass column1 to it and then within the stored procedure it would alter the table and add a new column called column1 to it.
So the stored procedure would look something like this:
The above SQL statement gives me an error:
Error 170: Line 3: Incorrect syntax near @columnName.
Is this possible??? And if so could someone please point out what I am doing wrong.
Thanks in advance
Simon
example: from my vb.net app I would call the stored procedure and pass column1 to it and then within the stored procedure it would alter the table and add a new column called column1 to it.
So the stored procedure would look something like this:
Code:
CREATE PROCEDURE [dbo].[spAddColumn] @columnName as varChar(50)
AS
ALTER TABLE myTbl ADD @columnName varChar(50)
GO
The above SQL statement gives me an error:
Error 170: Line 3: Incorrect syntax near @columnName.
Is this possible??? And if so could someone please point out what I am doing wrong.
Thanks in advance
Simon