Monday, February 13, 2012

Adding column to a table before an existing column

I simply need the ability using SQL to add columns in an existing table before (or after) columns that already exist.

The MS SQL implementation of ALTER TABLE doesn't seem to provide the before or after placement criteria I require. How is this done in MS SQL using SQL or is there a stored procedure I can use?

Thanks.You can do this easily through Enterprise Manager in the table design form. If you must do this using TSQL, then change your table through Enterprise Manager and instead of saving your changes use the button in the menu bar to script the changes. Copy the code and paste it into your application with whatever modifications you require.|||Why bother?

If the table has volumes of data, it'll take awhile...|||i agree
there is no reason to need to add a column before another column because you can change the order of the columns in the select list of your select statement.

it really doesnt matter where the columns exist.

No comments:

Post a Comment