Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert multiple columns in the existing table
Message
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Insert multiple columns in the existing table
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01315148
Message ID:
01315148
Views:
56
Hi everybody,

I have a big table in which I need to add several columns in the middle of the columns list.

These are my new fields I need to insert into the columns list.
[Title] [nvarchar](15) NOT NULL,
	[Occupation] [nvarchar](50) NULL,
	[BusinessName] [nvarchar](75) NULL,
	[BusAdd1] [nvarchar](50) NULL,
	[BusAdd2] [nvarchar](25) NULL,
	[BusCity] [nvarchar](22) NULL,
	[BusState] [char](2) NULL,
	[BusZip] [char](7) NULL,
	[Pager] [char](12) NULL,
	[Fax] [char](12) NULL,
	[BusinessPhone] [char](12) NULL,
	[Anniversary] [datetime] NULL,
	[Affiliation] [nvarchar](70) NULL
I can do it in the Designer one by one, but is it a simple way to change the table using script (preserving the original columns and data)?

I assume that with ALTER TABLE command I would add columns at the bottom of the list.

Tnanks in advance.

UPDATE. Ok, according to this http://www.bobsgear.com/display/ts/Adding+Column+After+Another+Column+-+SQL+Server+2005 and articles referenced there I can discard the idea for now and do it at the bottom.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform