ALTER the columns data type as varbinary

  • Hi,

    How to ALTER the varchar data type column into varbinary data type.

    For ex, i have a column (fldColA) which has varchar data type. Now i need to ALTER the column's (fldColA) data type as varbinary. How can i change by using script not by using GUI.

  • ALTER TABLE <Table Name>

    ALTER COLUMN <Column Name> <New type information>

    See Books Online for full details. Look under ALTER TABLE

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (11/23/2009)


    ALTER TABLE <Table Name>

    ALTER COLUMN <Column Name> <New type information>

    See Books Online for full details. Look under ALTER TABLE

    Thanks for your reply.

    I think i believe,it will through an error as Implicit Conversion not possible .....

  • If it does, then create a new column with the varbinary type. Update it from the varchar with convert, then drop the varchar column and rename the varbinary.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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