INSERT request error: implicit conversion from varchar to varbinary data type is not allowed. Use the CONVERT function to run this query.

I am trying to run an insert request, but I am getting the error below. How to pass values ​​to my insert statement? The value comes from the array, and the column type [cNotes] is varchar NULL .

Thanks in advance.

Error:

  Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query. The error occurred in C:\Inetpub\wwwroot\Components\Assessment.cfc: line 510 Called from C:\Inetpub\wwwroot\Components\Assessment.cfc: line 440 508 : ,NULL 509 : </cfif> 510 : ,'#arguments.notes#') 511 : </cfquery> 512 : </cffunction> -------------------------------------------------------------------------------- SQL INSERT INTO AssessmentToolDetail(iAssessmentToolMaster_ID ,iServiceList_ID ,cRowStartUser_ID ,Service_text ,cNotes) Values(251069 ,3592 ,NULL ,'y ' ,'') DATASOURCE TIPS4 VENDORERRORCODE 257 SQLSTATE HY000 ' 

CFC Function:

 <cffunction name="AddService" access="public" returntype="void" output="false"> <cfargument name="ServiceList" type="Components.ServiceList" required="true"> <cfargument name="notes" type="string" required="false" default=""> <cfargument name="serviceText" type="string" required="false" default=""> <cfquery name="AddServiceListQuery" datasource="#variables.dsn#"> INSERT INTO AssessmentToolDetail ( iAssessmentToolMaster_ID , iServiceList_ID , cRowStartUser_ID , Service_text , cNotes ) VALUES ( #variables.id# ,#ServiceList.GetId()# <cfif variables.rowStartUserId neq ""> , '#variables.rowStartUserId#' <cfelse> , NULL </cfif> <cfif ListFirst( Arguments.serviceText,'_' ) EQ ServiceList.GetId() > , '#Left(ListLast( Arguments.serviceText,'_'),1)# ' <cfelse> , NULL </cfif> , '#arguments.notes#' ) </cfquery> </cffunction> 
+4
source share
1 answer

The error indicates that you are trying to insert a row into a column with a binary storage format, and it cannot do the conversion implicitly.

Verify that the cNotes column in the AssessmentToolDetail table is of data type varchar(n) or nvarchar(n) , not varbinary(n) .

+4
source

All Articles