简体   繁体   English

INSERT查询错误:不允许从数据类型varchar到varbinary的隐式转换。 使用CONVERT函数运行此查询。

[英]INSERT query error: Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.

I am trying to run an insert query, but I am getting the error below. 我正在尝试运行插入查询,但我收到以下错误。 How can I pass the values into my insert statement? 如何将值传递给insert语句? The value is coming from an array and the [cNotes] column type is varchar NULL . 该值来自数组, [cNotes]列类型为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: CFC功能:

<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>

The error is saying that you're trying to insert a string into a column with a binary storage format, and it can't make the conversion implicitly. 该错误表明您正在尝试将字符串插入具有二进制存储格式的列中,并且它无法隐式进行转换。

Check that the cNotes column in the AssessmentToolDetail table has a datatype of varchar(n) or nvarchar(n) and not varbinary(n) . 检查AssessmentToolDetail表中的cNotes列是否具有varchar(n)nvarchar(n)的数据类型,而不是varbinary(n)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:不允许从数据类型varchar到varbinary(max)的隐式转换。 使用CONVERT函数运行此查询 - Error : Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query 不允许从数据类型varchar到varbinary的隐式转换。使用CONVERT函数运行此查询 - Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query 不允许从数据类型nvarchar到二进制的隐式转换。 使用CONVERT函数运行此查询。 - Implicit conversion from data type nvarchar to binary is not allowed. Use the CONVERT function to run this query. 获取错误不允许从数据类型datetime到int的隐式转换。 使用CONVERT函数运行此查询。 在sql server中 - getting error Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query. in sql server 不允许从数据类型sql_variant隐式转换为varbinary(max)。 使用CONVERT函数运行此查询。 ASP.NET SQL数据源 - Implicit conversion from data type sql_variant to varbinary(max) is not allowed. Use the CONVERT function to run this query. ASP.NET SQL DataSource 不允许从数据类型datetime到int的隐式转换错误。 使用CONVERT函数运行此查询 - Error of Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query Sql异常:不允许从数据类型datetime到int的隐式转换。 使用CONVERT函数运行此查询 - Sql Exception : Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query 不允许从数据类型datetime到int的隐式转换。 使用coonvert函数运行此查询 - Implicit conversion from data type datetime to int is not allowed. Use the coonvert function to run this query 不允许从数据类型varchar隐式转换为varbinary - implicit conversion from data type varchar to varbinary is not allowed 不允许从数据类型 nvarchar 到 varbinary(max) 的隐式转换 - Implicit conversion from data type nvarchar to varbinary(max) is not allowed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM