IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Date Conversion Options · View
pavants
Posted: Thursday, September 12, 2019 10:25:18 AM
Rank: Member

Joined: 6/4/2019
Posts: 13
Location: Trieste
Hello All,
I have a csv file where a date is in this format: MM/DD/YYYY and I'm trying to insert it in a SQL Database to a column of datetime2 format.
to do that I use parseDate passing as format [M,2]/[D,2]/[Y,4] but I get Type Mismatch The value '06/01/2019' is not of type 'date'

I tryed also with formatDate (which receive a string) but the problem is the same.

Any idea?
that
Posted: Thursday, September 12, 2019 11:04:43 AM
Rank: Advanced Member

Joined: 6/16/2006
Posts: 486
Location: AT
I can't explain why you're getting exactly this error message, but for a "datetime2" column, you could try if parse-dateTime instead of parse-date works for you.
pavants
Posted: Thursday, September 12, 2019 12:25:43 PM
Rank: Member

Joined: 6/4/2019
Posts: 13
Location: Trieste
found the problem, the column was declared as Date. Changed to String and parsed it as date.
pavants
Posted: Thursday, September 12, 2019 2:18:45 PM
Rank: Member

Joined: 6/4/2019
Posts: 13
Location: Trieste
Ok,
Sorted out the problem on transforming from string to date but now when I try to insert the data in MSSQL database the code generated is:

INSERT INTO [Mytable] ([Rcvd_DateTime]) VALUES (2019-09-12T15:44:47.007+02:00)

Testing it in _Sql management studio I have an error on T15:, which is the best way to write this type of data in the db ?
K101
Posted: Friday, September 13, 2019 7:01:08 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 564
Try date-from-datetime or substring-before("T").
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.