Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
newman
Starting Member
7 Posts |
Posted - 2005-08-27 : 09:26:40
|
| hello friends!I hav a table..which has 4 columns and 5 rows..whenever i add a new column it goes to end of the table.. Now i want to add a new column in between 2nd and 3rd column..Is there a way to add a new column to a specified place in a table??THANKYOU! |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-08-27 : 09:35:01
|
| Not without dropping and recreating the table. SQL does not care where columns are positioned, you can always write a SELECT statement that arranges the columns in the sequence you prefer. And since that is the case, you can simply add the new column using ALTER TABLE myTable ADD newcolumn...etc., Books Online has the syntax under "ALTER TABLE". |
 |
|
|
jaffa_cree
Starting Member
13 Posts |
Posted - 2005-08-27 : 23:03:41
|
| I think you can do this through Enterprise Manager.Open the table in design view. Select the column you want to add in front of, and right click -> insert new column.Not sure whether this can be done in QA though. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-08-28 : 08:50:33
|
| All Enterpise Manager does is create a new table, copy the data to it, then drops the old and renames the new one. You can see this by saving the SQL that EM generates. |
 |
|
|
svicky9
Posting Yak Master
232 Posts |
Posted - 2005-08-28 : 16:13:42
|
| HiTry thisGo to enterprise managerright click the tableOpen the design viewHighlight the column where u want another col to be insertedRight click that and u have an option of inserting a new colVicVicky |
 |
|
|
|
|
|