Datetime type mismatch trying to publish a SQL CLR database
I’m trying to stand up an old solution that’s publishing a number of .net functions to a SQL Server database. But the attempt to publish to a new database is failing on a function that manipulates dates.
The function that’s failing is:
The error message I get when attempting to publish is:
SQL generated from the .net in an attempt to add the function:
SQL definition for the version of the function in the existing database (which confirms that @MattJohnson was right about how it needs fixed):
The SQL function doesn’t match the .NET method signature. To make it match:
Also, note that if you are on SQL 2016 or later, or on Azure SQL DB, you don’t need this function, as you can now use