The double quotes not part of the statement and it can be removed.
I tried -
Sql(‘Datastore_temp’,‘insert into test2 (VARIABLE_NAME, VARIABLE_VALUE, TIMESTAMP) Values (‘Check1’,‘99’, sysdate from dual)’)
It pars but when i try to run it it fail in this with error SQL not terminated correctly or missing comma
What are your data formats for columns ‘VARIABLE_NAME’ and "VARIABLE_VALUE’? I think the error message may be referring to one of these columns. In particular, I’m suspicious of VARIABLE_VALUE. If this a numeric column you won’t need the quotes around the value to insert.
mamou, you are running into a slew of issues here, possibly because you aren’t familiar with some of the ways Data Services does things.
Passing in a date as a string without specifying the format is a violation one of my cardinal rules. Never, never, ever pass a date as a string unless you wrap it in a function that specifies the format. Why? Because the default date format on the client (job server) is never guaranteed to be the same default date format on the database server. Is 12/24/01 supposed to be MM/DD/YY, DD/MM/YY or YY/DD/MM? If it is the second then you have an invalid date.
Instead, you always do something like this: to_date(‘12/24/2001’,‘MM/DD/YYYY’). That way there is NEVER any question of what the date really is.
In my opinion, not specifying the format is sloppy programming. I have fixed many ETL jobs for clients where this was coded. Keep doing it, that’s how I get paid!
When the square brackets [ and ] are used within a string in Data Services the code or variable within the brackets is evaluated and the resulting string is substituted into the parent string. This would NEVER work: VALUES (‘Check’,‘99’, [$L_Any_Variable_name]) because the value within the variable is a string and the result would be an unquoted string - and a syntax error by the database.
When the squiggly (aka curly) braces { and } are used then the substitution value is wrapped in single quotes. The database won’t give you a syntax error but it could either give you a date conversion error or - even worse - it could incorrectly convert the string to a date.
eganjp -I do understand now where it all went wrong and I appreciate your input.
However, i really find it confusing where to use the escape character , comma, curly bracket { and [. (I’hv gone through all SAP BODI documentation and tutorials) but I would really appreciate if some one can direct to me a book/online-resource or can explain the scripting Technics in DI/DS.