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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Column Insertion

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 one
3. Drop the old table
4. Rename the new table with the old name

This is what Enterprise Manager does behind the scenes.
Go to Top of Page

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 problem

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -