Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

alter table [tablename] add column ....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kei - 03 Jul 2008 09:35 GMT
I want to add a column in a table and placed it in the first column, how to
write this sql statement?
(the alter table [tablename] add [columnName] ) only add the new column in
the last column.
Uri Dimant - 03 Jul 2008 09:55 GMT
kei
You will have to drop and the create a table. Why is so important to  you a
column's order?
Do you try to add a column that is PK?

>I want to add a column in a table and placed it in the first column, how to
> write this sql statement?
> (the alter table [tablename] add [columnName] ) only add the new column in
> the last column.
Kishore - 03 Jul 2008 10:59 GMT
Hi

if you alter table and add column, it will add new column at end. but if you
want to add column at first, you have to copy the table structure and data
into another temporary table. and create New table with addition of new
column, and again save data from temporary table into  Newly created table
and finally drop the temporary table..

thanks and regards
Kishore

> I want to add a column in a table and placed it in the first column, how to
> write this sql statement?
> (the alter table [tablename] add [columnName] ) only add the new column in
> the last column.
kei - 03 Jul 2008 11:06 GMT
Oh!! there is a "generate change script" in the tool bar, I can just add a
column and drag and drop the column to the top, and then press the "generate
change script" to generate the script!!

> Hi
>
[quoted text clipped - 11 lines]
> > (the alter table [tablename] add [columnName] ) only add the new column in
> > the last column.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.