arame3333
arame3333

Reputation: 10193

Sql Servers mismatch for date format

I am finding that a stored procedure works on my development SQL Server but not on my staging SQL Server. I found that the problem is tried to store a date, the 2 SQL Servers respond different. So I have isolated the SQL code where the problem is. On development my datetime field is fine, but not for staging:

enter image description here

enter image description here

I need to know how to get these 2 database servers to match each other for datetime formats.

Upvotes: 1

Views: 204

Answers (2)

Siyual
Siyual

Reputation: 16917

You need to change the DATEFORMAT configuration for it to work correctly. Use the following:

Set DateFormat YMD

Declare @Logged DateTime
Set @Logged = N'2017/07/26 11:32:01.161'

Select @Logged

Upvotes: 2

Tab Alleman
Tab Alleman

Reputation: 31775

Check the locale settings of your Staging computer. I bet it is set to use YYYY/DD/MM as the default date format, so it thinks you are trying to use 26 for the month, which would be out of range.

Upvotes: 2

Related Questions