INSERT values in VARBINARY(MAX) column

我的梦境 提交于 2020-01-03 04:21:05

问题


I've table with VARBINARY(MAX) column and I'm tried for inserting value into that table.but I can't. QUERY is

INSERT INTO [I_RACEDB].[dbo].[tce_lineno]([lineNo] ,[testCaseName] ,[project])
 VALUES (<lineNo, varchar(250),> ,<testCaseName, varbinary(max),>,<project, varchar(100),>)

INSERT INTO [I_RACEDB].[dbo].[tce_lineno] ([lineNo],[testCaseName],[project])
     VALUES ('44','TestCase_TestCheck01_Mail_Validation','proj001')

ERROR is:

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

How can I insert the values?


回答1:


The error is self explaining.

Use convert(VARBINARY(max), 'TestCase_TestCheck01_Mail_Validation')

I.e.:

INSERT INTO [I_RACEDB].[dbo].[tce_lineno] ([lineNo],[testCaseName],[project])
VALUES ('44',convert(VARBINARY(max), 'TestCase_TestCheck01_Mail_Validation'),'proj001')


来源:https://stackoverflow.com/questions/28293221/insert-values-in-varbinarymax-column

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!