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
 General SQL Server Forums
 New to SQL Server Programming
 adding a new column between two columns

Author  Topic 

rj8519
Starting Member

2 Posts

Posted - 2011-07-10 : 14:41:35
I am trying to add a new column between two existing columns

lets say there are there columns A B and C and now i want to add column B1 between B and C.

i am using oracle plus.

thanks

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-07-10 : 14:51:57
This is a MS SQL Server site. But there's no reason to add a column between 2 other columns. Just select the columns in the order that you want.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2011-07-10 : 15:20:57
This forum is SQL Server and not Oracle. But this is an absurd question in any SQL. Do you know that the rows in a table have no ordering? Tables are sets, etc. You locate them by keys. Guess what! Columns have no ordering either; you locate them by name. In fact, many SQLs store the varying length columns at the end of the physical records on the disk. Good SQL use SELECT * in EXISTS() and some derived table situations. Otherwise, the column names are listed explicitly.

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-07-11 : 05:41:51
quote:
Originally posted by rj8519

I am trying to add a new column between two existing columns

lets say there are there columns A B and C and now i want to add column B1 between B and C.

i am using oracle plus.

thanks



Don't worry about the order of the column. If you want it in specific order do it via select statement or create a new view with the columns specified with the correct ordinal position

Madhivanan

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

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-07-11 : 06:16:03
And if you still insist of having them in a specific order in the designer the only way to achieve this is to drop and recreate the table.

- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page
   

- Advertisement -