Alter Column Name

  • Hi Everyone

    Please help,

    I want to amend the name of a couple of columns but I cant find the necessary help files.

     

    Create table matsTable

    (field1 char(8) not null,

    field2 money not null)

    go

     

    what I want is to change field 2 to new name

    alter table matsTable

    (field1 char(9) not null,

    newname money not null)

    go

     

    cheers

     

    Mat

  • Try this one:

    exec sp_rename 'matsTable.field2', 'newname', 'COLUMN'

  • and to complete :

    ALTER TABLE matsTable

    ALTER COLUMN field1 CHAR(9) not null

  • Thanks guys,

    I have used the sp_rename

    cheers

    Mat

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

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