CLR returns dates in different formats on different servers

  • Hi,

    I've just restored a DB from one server to another. Part of the DB is an assembly used in a Function that unencrypts some data held in a Varbinary(Max) column.

    When I execute it on the original server it works fine across all rows of the table, when I execute it against the new server it fails because it's seeing dates in MM/DD/YYYY format, it works if the day of the month is less than 13, but obviously the date would be wrong!

    Setting the DATEFORMAT to MDY prior to executing the function has no effect either.

    It's the same DLL in the same location, the SQL Server settings as returned by DBCC USEROPTIONS() are identical.

    The SQL Server editions and Window OS are the same

    New Server

    Microsoft SQL Server 2012 - 11.0.2100.60 (X64)

    Feb 10 2012 19:39:15

    Copyright (c) Microsoft Corporation

    Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)

    Old Server

    Microsoft SQL Server 2012 - 11.0.2100.60 (X64)

    Feb 10 2012 19:39:15

    Copyright (c) Microsoft Corporation

    Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )

    I'm thinking the DLL is being affected by some setting either in the Windows OS or a SQL Server setting but I don't know where, so any help is appreciated.

    Regards

    Giles

  • On instinct I've looked in the Date and Time settings in Control Panel, there were set to dd/MM/yyyy as I'd expected, so I switched them to MM/dd/yyyy and the dates were being accepted.

    Now here's the strange thing. I changed it back to dd/MM/yyyy and it still worked.

    Go figure.

  • wrong, I've found out someone deleted the dates to get around the problem! We've put the dates back in and the problem persists.

    Does anyone have any ideas?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply