简体   繁体   中英

conversion failed when converting date and/or time from character string in mule batch commit

I am executing merge statement for inserting/updating a column of datetime data type in sql server.

payload.date looks like 2014-02-03 00:00:00.000

Batch fails with the error 'conversion failed when converting date and/or time from character string'

     <batch:step name="step_1">
     <batch:commit  doc:name="Batch Commit" size="100"> 
            <db:execute-ddl config-ref="config"  doc:name="merge" >
                <db:dynamic-query><![CDATA[
                BEGIN  
                MERGE tablename AS Target 
                USING (SELECT '#[payload.key]')  AS Source (ID) 
                ON (Destination.Id=Source.ID) 
                WHEN MATCHED THEN UPDATE SET 
                datefield = '#[payload.date]' 
                WHEN NOT MATCHED THEN
               INSERT (datefield) values ('#[payload.date]');

                END]]></db:dynamic-query>
                            </db:execute-ddl>
            </batch:commit> 
    </batch:step>

If i remove batch commit, i am not getting any error and the merge statement works fine and the dates are updated/inserted into DB. I want to use batch commit, how can i resolve this issue?

执行ddl操作不支持批量模式,因此不能使用批量提交

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM