0
I have the following situation.
Executing that script
:
SELECT CONVERT(DATETIME, CONVERT(VARCHAR, 12) + '/'
+ CONVERT(VARCHAR, 31) + '/'
+ CONVERT(VARCHAR, 1900) + ' '
+ CONVERT(VARCHAR, 0) + ':' + CONVERT(VARCHAR, 0)
+ ':' + CONVERT(VARCHAR, 0))
I get the following error:
Message 242, Level 16, Status 3, Line 2 The conversion of a type of data scan on a data type datetime resulted in an off value of halftime.
If you add the command Set Dateformat mdy
the script works properly:
31/12/1900 00:00:00
Doubt:
I’m making a update
in a linked server table, it has a trigger
where there is the script
quoted above. Then I try to put the dateformat
before the update
, but returns the cited error. I realize this happens because I am logged in to one session and the linked server is in another and so returns the error.
How can I treat this ? bearing in mind that I cannot change the trigger
of the linked server (Linked)
**Remembering that the two users in each server are with the Portuguese language .
Wouldn’t it be easier to use the Convert(datetime, '20200101 03:04:21',103)? So you don’t need to use the Dateformat
– Marcos ACR
@Marcosacr the problem is that I can’t change this script because it’s an ERP of the company I’m looking for via Linked. Strange is that if I run inside the server I do Linked works, but running via Linked accuses the date error.
– Aprendiz