ALTER TABLE with several ALTER COLUMN

  • HEllo!

    Can I do the following:

    alter TABLE [dbo].[ARCHIVE_TABLE]  
    

    COLUMN [TableName] varchar(255),
    column [sColumn] varchar(300)

    GO

    -Lars

    Please only reply to this newsgroup. All mails would be bounced back.


    -Lars

    Please only reply to this newsgroup. All mails would be bounced back.

  • Don't think you can alter multiple columns in the same alter table statement - think you need to do it like this:

    
    
    alter table [dbo].[ARCHIVE_TABLE]
    alter column [TableName] varchar(255)

    alter table [dbo].[ARCHIVE_TABLE]
    alter column [sColumn] varchar(300)
    GO

    Cheers,

    mia

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.


    Cheers,
    mia

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.

  • NB - If you're adding rather than altering columns, you can do it in one go like this:

    
    
    alter TABLE [dbo].[ARCHIVE_TABLE]
    add [Tablename] varchar(255),
    [sColumn] varchar(300)
    go

    Sorry for 2 posts - just realised it wasn't clear whether you were altering or adding the columns!

    Cheers,

    mia

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.


    Cheers,
    mia

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply