Reputation: 41
The data I get from an e-mail parsing is in the format '23 juli 2016' (dutch date) and I need to put this in SQl-server. So I have the following query:
INSERT INTO test(naam, email, telefoon, res_nummer, datum, tijd, aantal, opmerkingen)
VALUES( 'James',
'[email protected]',
'0123456789',
'1234567890',
'23 **juli** 2016',
'19:00',
'2',
'geen')
Now when I run this query I get
"Msg 241, Level 16, State 1, Line 1 Conversion failed when converting date and/or time from character string."
So this means the date is not in a correct format. Changing it to the English format is the solution so the query:
INSERT INTO test(naam, email, telefoon, res_nummer, datum, tijd, aantal, opmerkingen)
VALUES( 'James',
'[email protected]',
'0123456789',
'1234567890',
'23 **july** 2016',
'19:00',
'2',
'geen')
works just fine.
I just can't figure out how to change the dutch month name into the English one using SQL statements in a way the every month is converted automatically. The format of the date is always the same (dd month year). Any suggestions?
Upvotes: 0
Views: 622
Reputation: 44881
You could temporarily change the language used before you run the insert and then change it back to w/e it should be.
Try Set Language 'Nederlands'
before the insert to make the Dutch names acceptable.
Upvotes: 1