+ 1

how to add a column using stored procedure ?

i want to add column using sp

5th Dec 2016, 6:05 PM
SQL LOVER
SQL LOVER - avatar
2 Answers
+ 41
ALTER TABLE add COLUMN
5th Dec 2016, 8:12 PM
Jose
+ 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
5th Dec 2016, 8:36 PM
Charles Torry
Charles Torry - avatar