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: 

Insert timestamp into external MS SQL table using ABAP

former_member239066
Participant
0 Kudos

Hi Expert,

We have a requirement for which we have to insert records in an MS SQL table. The table contains a field of type DATETIME. We need to fill that field with the actual date and time.

We have concatenated date and time in the format 'YYYY-MM-DD HH:MM:SS' and we are getting the dump 'SQL error 241 occurred while executing Native SQL.'.

We are looping on an internal table to insert each record 1 by 1.

Could you please help to find a solution for the timestamp?

Thanks,

Vitish.

1 ACCEPTED SOLUTION

former_member239066
Participant
0 Kudos

Hello Jelena,

The issue is solved. The timestamp format should be 'YYYY-DD-MM HH:MM:SS' instead of 'YYYY-MM-DD HH:MM:SS'.

Regards,

3 REPLIES 3

Jelena
Active Contributor
0 Kudos

What have you tried so far? Google -> "SQL error 241" finds 400K+ entries, surely some of the posts should have triggered some ideas and further analysis. Ask the external database's DBA as well. It's not really an ABAP question.

former_member239066
Participant
0 Kudos

Hello Jelena,

The issue is solved. The timestamp format should be 'YYYY-DD-MM HH:MM:SS' instead of 'YYYY-MM-DD HH:MM:SS'.

Regards,

0 Kudos

If this is resolved then kindly let others know by accepting an answer. Otherwise this still shows up as "unanswered". Thank you.