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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-01-10 : 08:02:35
|
Ravi writes "Dear SQL Guru,I want to insert a new column in a table at a specified position i.e. between 2 columns. or in other words I want to decide the ordinal position of the column throuhg my code / SQL statement. Is this Possible....?" |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-01-10 : 08:03:41
|
No. The only way to do it is:1. Create a new table with the new column in the position you want;2. Copy the data from the old table into the new one3. Drop the old table4. Rename the new table with the old nameThis is what Enterprise Manager does behind the scenes. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-10 : 08:16:09
|
Also, there is no point in having a column at particular ordinal position. You can have it at any position in your select statement. In your Front End Application, dont use rs(0), rs(1),etc.Instead use rs("ColumnName"). Then you are good to go without any problemMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|