Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2008, 11:24 PM
Authorized User
 
Join Date: Oct 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting new field to a table

Hi,

Is there a way or script to add a new field to existing table in between other fields? I am using Sybase 12.x.

The statement ALTER TABLE <table name> ADD <newfieldname>
will add a new field, but it will be placed as the last field of the table. I would like to insert the new field in between two existing field.

Thanks a lot!

 
Old March 18th, 2008, 09:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hey there.. the "view" of the fields, altough not random, could be easily altered by a select statement. Why do you want to add a field in the middle of other two?

And no, you can't in an easy way. (You could create a new table with the field in the correct position and then pass the data to it, but what's the point?).

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old March 18th, 2008, 09:37 PM
Authorized User
 
Join Date: Oct 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, thanks for the reply. We have an existing system that loads records from a native file to a table. We need to add another column to the native file, and thus to the table also. We cannot drop and recreate the table. And the client wants to retain the order of the fields.

Thanks for your reply anyway! :)


 
Old March 19th, 2008, 12:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well, as I said before, you can't without changing the table.

What if you just change the import system???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting comma in the field issaq SQL Language 0 February 20th, 2008 08:41 AM
inserting worksheet into an OLE field with VBA Mihai B Excel VBA 2 January 21st, 2005 06:50 AM
Inserting worksheet into OLE field Mihai B Access 0 November 24th, 2004 07:39 AM
inserting worksheet into an OLE field with VBA Mihai B Access VBA 0 November 23rd, 2004 10:28 AM
Regarding Inserting values to ntext field Hari_Word ADO.NET 1 August 31st, 2004 05:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.