I need to change the datatype of a column in a table from Char to Varbinary. How to do it without altering the column position in table? RRS feed

  • Question

  • Sir,

    When I try ALter Table TableName1 columnName1 Varbinary(80), I get this message

    Implicit conversion from data type char to varbinary is not allowed. Use the CONVERT function to run this query.

    I can drop column and add column. but the column position changes in table and I dont like that as the column is part of PK. Pl. tell me how I can achieve this.

    Thanks in advance,

    Paniraj N



    Tuesday, October 18, 2011 7:20 AM


  • Why does it matter to have different column position? What is the exact concern?

    If you are using "Select *" syntax than its really a bad coding, you should fix that.

    If you want same order, drop and recreate the table.
    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog | Team Blog | @Twitter
    • Marked as answer by Paniraj N Tuesday, October 18, 2011 10:21 AM
    Tuesday, October 18, 2011 8:21 AM