on 10-02-2015 10:45 AM
Hi Experts,
I have a problem updating SQL server 2008 table through BODS 4.2
My design as below
Job--->Worflow--> Script1--->Dataflow--->Script2
Script1: Here we are updating starttime before dataflow start. The below script is working fine for updating Startload.
SQL('DS_ODS','UPDATE Timestamp_Tables SET StartLoad = CURRENT_TIMESTAMP WHERE TableName = \'30DayOrderDemand\'');
Script2: Here we are updating endtime after dataflow completes. This is not working and its throwing error like incorrect syntax near '30' but its working for above script. Here only column name is different and both the cloumns are same datatypes Datetime.
SQL('DS_ODS','UPDATE Timestamp_Tables SET LastLoad = CURRENT_TIMESTAMP WHERE TableName = \'30DayOrderDemand\'');
Thanks & Regards,
Balamurugan G
Hi,
Please validate and run your query in any SQL editor if available to catch the exact error.
If it is working fine in editor, the only change you need to make is adding escape characters while pasting in BODS.
Thanks
Sameera.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sameera,
I have validated in SQL editor and update is working with error. Through BODS also LastLoad getting updated but its throwing an error.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '30'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
(1 row(s) affected)
(1 row(s) affected)
Thanks,
Bala G
Bala,
Please find my understanding and correct me.
You tried to run the following statement in a SQL editor
UPDATE Timestamp_Tables SET LastLoad = CURRENT_TIMESTAMP WHERE TableName = '30DayOrderDemand';
and editor returned you an error-- Incorrect syntax near the keyword 'with'....
I'm confused since we don't have a WITH keyword anywhere in the above statement and editor is returning this error.
Dear Friends,
My sincere Thanks to everyone for your valuable inputs and finally we found reason, there is trigger exist for LastLoad column in Timestamp_Tables and spoke business they are planning to change the table name to Demand30DayOrder instead of 30DayOrderDemand .
Thanks & Regards,
Balamurugan G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Balamurugan,
Please try the below query
SQL('DS_ODS','UPDATE Timestamp_Tables SET LastLoad = CURRENT_TIMESTAMP WHERE TableName = ''30DayOrderDemand''');
Also, please confirm the column name LastLoad. If confirmed, try using the column names within double quotes.
Regards,
Varun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your table name starts with a number, this may be causing issue. Use double quotes for your table name in your script.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ansari,
I hope you are doing good. Thanks for your response. Already I tried with double quotes it didn't works. it works if we change the tablename values with double quoute in both places.. script & Timestamp_Tables in database but i don't want to use double quotes in the Timestamp_Tables.
Thanks & Regards,
Balamurugan G
By standard you should not have a table name starting with a number.
See this article, it has some explanation.
sql - Table or column name cannot start with numeric? - Stack Overflow
Hello,
Maybe you should make a commit operation explicitly after the last update statement.
Hope it helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Balamurugan,
Before executing the job again, can you please try the below options to check if there are no syntax issues:
1. Can you first validate the script(Script2) and the entire workflow and check if there is any syntax error at any place?
2. Is the code that you pasted the only thing in the Script2 ?
Let me know if the above observations are correct at your end.
Thanks,
AJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.