+ 1
how to add a column using stored procedure ?
i want to add column using sp
2 Answers
+ 41
ALTER TABLE add COLUMN
+ 2
This really depends on your sql version. Some SQL would require you define the command below as a string and 'EXEC' it. Others would require you to Define the string, prepare it then execute. The gist is as such:
CREATE PROCEDURE CustomAddColumn
(vTableName VARCHAR(30),
vColumnName VARCHAR(30),
vDataType VARCHAR(80))
BEGIN
ALTER TABLE vTableName ADD COLUMN vColumnName vDataType;
END