cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion error while inserting client data into SycloExchangeTable

Former Member
0 Kudos

While inserting client data using client exchange step  in main fetch I am using sql as back end.

The sql query is :

<<local lastUpdate=<<if <<eq <<lastUpdate format="%Y">> "0000">>

       "<<database.tempdate>>"

else

       "<<lastUpdate>>"

>>

>>

INSERT INTO SycloExchangeTable

VALUES

('<<object.CustId>>','<<user.agentryID>>','<<server.serialNumber>>','<<lastUpdate format="%Y-%m-%d %H:%M:%S">>',NULL)

when I click on transmit I got this error

2015 06 04 14:56:29#+0530#ERROR#com.sap.mobile.platform.server.agentry.console##anonymous#Agentry Runtime Worker Thread###Exception: 14:56:29 06/04/2015 : 16 (SQLBEException), SQLQueryError (Fetch "MainFetch" ClientExchange "InsertExchangeStep", 3: SA_DBMS_API_Error, DB Code: 241, DB Text:22007 [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string., ), query.cpp#145:SQLQuery::run |

Please help me in resolve the error

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

If your last update is not populated you will get an invalid date string (1-1-0000 I believe).  That is why there is the logic at the top to check and create the local lastupdate value which will be defaulted to a valid tempdate if not set.

Your insert step should reference <<local.lastUpdate>> instead of the <<lastUpdate with the format parameter.  You also do not need the single quotes around <<local.lastUpdate>> as the returned value will automatically include the single quotes.

--Bill