Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL statement for updating UDF Date field

rwong_gnb
Explorer
0 Kudos
1,188

Hi all,

I have a user-defined field in my Production Order module that is of Date type. I am trying to learn the syntax for updating this field with a new date via SQL.

When I attempt to run this query in HANA Studio:

UPDATE T0 SET T0."U_Test" = '12/12/2019' FROM <DATABASE>.OWOR T0 WHERE T0."DocNum" = 21568

I get this error:

Could not execute 'UPDATE T0 SET T0."U_Test" = '12/12/2019' FROM <DATABASE>.OWOR T0 WHERE T0."DocNum" = 21568' SAP DBTech JDBC: [2]: general error: prepare UPDATE failed.

is there a specific format that the date string needs to be or am I missing something else?

Thanks for any help you can give!

  • SAP Managed Tags:
1 ACCEPTED SOLUTION

294

Please use date format as 'YYYY-MM-DD'. Refer below SQL.

UPDATE T0 
SET T0."U_Test" = '2019-12-12' 
FROM <DATABASE>.OWOR T0 
WHERE T0."DocNum" = 21568
  • SAP Managed Tags:
2 REPLIES 2

295

Please use date format as 'YYYY-MM-DD'. Refer below SQL.

UPDATE T0 
SET T0."U_Test" = '2019-12-12' 
FROM <DATABASE>.OWOR T0 
WHERE T0."DocNum" = 21568
  • SAP Managed Tags:

0 Kudos
294

That was very helpful - thank you!

  • SAP Managed Tags: