有INI表,当中有三个字段(AA,BB,CC),现在需在第二个字段BB前新增一个字段TT,请问各位高手,如何写这一SQL语句?

解决方案 »

  1.   

    create table temp~ (aa char[10] ,bb char[10],cc char[10])
    go
    insert into temp~ select * from ini 
    go
    drop table ini
    go
    create table ini (aa char[10],tt char[10],bb char [10],cc char[10]) 
    go
    insert into ini select * from temp~
    go
    drop table temp~
    go
      

  2.   

    楼上方法可行!但是若需要考虑数据问题时,就出现问题了。建议方法:
    使用SQL语句中的 InsertColumn方法,可以查帮助解决这个问题。
      

  3.   

    TO:hujinger
       能否写一个SQL语句例子,帮助说得不是很清楚?
      

  4.   

    alter table add columns
    标准的SQL语句,但只能将列放在最后。对于关系型SQL数据库来说,列的顺序是无所谓的,只需要在select语句中指定一下便可以了
      

  5.   

    对啊,
    看看 tsql的帮助你就知道是行不通的:Res
    Use the InsertColumn method when the ordinal position of a column must be maintained.Note  Columns in existing Microsoft® SQL Server™ 2000 tables have fixed ordinal location. You cannot use the InsertColumn method when the Table object references an existing SQL Server table. Use InsertColumn only when the Table object is used to create a SQL Server table.