SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 adding a new column between two columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rj8519
Starting Member

USA
2 Posts

Posted - 07/10/2011 :  14:41:35  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 07/10/2011 :  14:51:57  Show Profile  Reply with Quote
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

USA
547 Posts

Posted - 07/10/2011 :  15:20:57  Show Profile  Visit jcelko's Homepage  Reply with Quote
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

India
22755 Posts

Posted - 07/11/2011 :  05:41:51  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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

Norway
3271 Posts

Posted - 07/11/2011 :  06:16:03  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000