Re: alter table add column question



I think it isn't possible to do what you want, without recreating the table
as you mentioned.

I think that ability was not included because in the theoretical SQL scheme
of things, physical position of the column is supposed to be irrelevant. In
fact, it's probably supposed to be unknowable to the consumer of the data.
Theoretically. Of course, practicality occasionally gets in the way of
theory.



"Keith G Hicks" <krh@xxxxxxxxxxx> wrote in message
news:O1kQHpvwFHA.2348@xxxxxxxxxxxxxxxxxxxxxxx
> Is there a way to specify what position a column is in the table when
> altering tables in code? I have a client that has me do major updates
> annually which involve removing obsolete columns and adding new columns. I
> set up code in batches and thoroughly test things before altering their
> production data. So I might have a prg file that does soemthign like this
> (dumb example but you'll get the idea):
>
> alter table Customer drop column KidsNames
> alter table Customer add column DogsNames c(50)
>
> Let's say there are 12 columns in the table and I'd like DogsNames to
> occupy
> the 6th position. I know of course that I can do "modi stru" and move it
> manullly but that defeats the purpose of writing my code. How can I
> position
> columns so that they are not just tacked onto the end of the table?
>
> Thanks,
>
> Keith
>
>


.



Relevant Pages

  • alter table add column question
    ... set up code in batches and thoroughly test things before altering their ... alter table Customer drop column KidsNames ... alter table Customer add column DogsNames c ...
    (microsoft.public.fox.programmer.exchange)
  • Table Design Review wanted
    ... CreditCard, but I am really not sure what to do about this. ... the CustomerID in the tables related to customer a FK:PK should I even ... ALTER TABLE ADD CONSTRAINT PK_Customer ...
    (microsoft.public.sqlserver.programming)
  • Re: (OT)If Darth Vader were designed by Japanese schoolgirls...
    ... not for those with an aversion to pink... ... "I am altering the hemline. ... Pray I don't alter it any further." ...
    (rec.arts.anime.misc)
  • Re: alter table add column question
    ... Keith G Hicks wrote: ... > set up code in batches and thoroughly test things before altering their ... > alter table Customer add column DogsNames c ... Are you writing code that relies on column positions? ...
    (microsoft.public.fox.programmer.exchange)
  • RE: Alter Table Query - Easy Question
    ... ALTER TABLE Customer ADD COLUMN CustID COUNTER PRIMARY KEY; ... > ALTER TABLE Customer ADD COLUMN ID INTEGER AutoNumber; ...
    (microsoft.public.access.queries)