none
Implicit conversion from data type datetime to varbinary is not allowed. Use the CONVERT function to run this query. RRS feed

  • Question

  • I am trying to Alter a column and i am getting the following error

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

    Where  should i use the cast or convert?

    alter table [dbo].[categories]
    alter column [row_timestamp] varbinary(8)

    Thank You

    Monday, December 2, 2019 3:51 PM

Answers

  • If you don't have data in your old column, drop it and create it with binary data type.

    If you have data in your old column, create a new binary column with a different name and update this column with explicit conversion from your old column. Drop your old column and rename your new column to the old column name.

    • Marked as answer by AmyBI Monday, December 2, 2019 4:16 PM
    Monday, December 2, 2019 4:13 PM
    Moderator

All replies

  • If you don't have data in your old column, drop it and create it with binary data type.

    If you have data in your old column, create a new binary column with a different name and update this column with explicit conversion from your old column. Drop your old column and rename your new column to the old column name.

    • Marked as answer by AmyBI Monday, December 2, 2019 4:16 PM
    Monday, December 2, 2019 4:13 PM
    Moderator
  • Thanks that is what i did worked :-)
    Monday, December 2, 2019 4:16 PM