
Hi
We can not Add any column middle of the existing tab;le structure... without Re-Create the table (Drop and Create)
But, we have some alternate steps here...
If the table already have Id, Name, Place on tbl_cosmetics. OK
If you want to add a new column called Phone next to Name column... like
Id, Name, Phone, Place
So...
/*Copy and Create a new table along with your new column structure(Inclusing column length, Data type)*/
Select Id, Name, Cast('' as Varchar(15)) As Phone, Place Into tbl_cosmetics_Temp from tbl_cosmetics
Go
/*Change your actual table name to something else*/
EXEC Sp_Rename 'tbl_cosmetics','tbl_cosmetics_Old','Object'
Go
/*Change the new table to your actual name*/
EXEC Sp_Rename 'tbl_cosmetics_Temp','tbl_cosmetics','Object'
Go
Note:
1. Before you start this acivity, take a note on constraints / Indexes
2. You have to apply all constraints and Indexes again once you done the above steps...
Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions
Akiii, if this helps please login to Mark As Answer. | Alert Moderator