locked
Issue while using varbinary(max) datatype RRS feed

  • Question

  • Hi Team,

    We migrating mysql database to sql server 2012 db.

    We have a table in which it has a blob datatype and while migrating into MSSQL I have changed to varbinary(max) datatype.

    Now,I am facing the issue when i am trying to Insert a row into the table and I am geeting the below error,

    INSERT INTO so_xxxxxx (order_number, backorder_suffix, signature, custname, order_status)
    VALUES ('13682382', '', 'RSZFKEYxRjJISklPSFL//x0+HzwpNys2TShaImwcgBeGGIgYhxqBIngrbjNqNmI+YT9jQGhDbEVzSHpPe1F7U3tUelZ5WHdZdFtyXW5fbV9sYGphaGFlYmRiY2L//5kemB2YH5ghmSWaKJsrnTKeNaA6oT+iQqNHpEulUKZbpl6mYaZkp2X//8MlvSi7KbcttDCyMbAzrDemO6Q9oj6gP55AnEGbQppDmUOZQppAnD+dP58/oD+jQKhDqkasSK9KtVG4U71YwFzDXcVfxmDIYspjy2X//5dRkVD//89bzV3//w==', 'bk', '66')

    Msg 257, Level 16, State 3, Line 1

    Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.

    Please let me know how to fix this issue.

    Thanks,

    Sarvan.N

    Wednesday, November 14, 2012 6:41 AM

Answers

  • Hello Sarvan,

    As the message already say, you have to convert explict the string to varbinary(max); sample:

    SELECT CONVERT(varbinary(max), 'RSZFKEYxRjJISklPSFL//x0+HzwpNys2TSh')


    Olaf Helper

    Blog Xing


    Wednesday, November 14, 2012 6:55 AM
    Answerer