Reputation: 10193
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:
I need to know how to get these 2 database servers to match each other for datetime formats.
Upvotes: 1
Views: 204
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
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