June 15, 2016 at 4:42 pm
Is there something I'm missing here?
select @@version
Microsoft SQL Server 2014 - 12.0.4213.0 (X64) ...
SELECT TRY_CONVERT(datetime2, '12/31/2010') AS Result;
Msg 195, Level 15, State 10, Line 64
'TRY_CONVERT' is not a recognized built-in function name.
The same function works in my 2012 instance, but not my 2014.
--=Chuck
June 15, 2016 at 4:50 pm
It was the compatibility level of the database. It was set to something too old. I switched databases and it worked without problem.
--=cf
June 16, 2016 at 8:10 am
It possible to 2012 server...,
SELECT TRY_CONVERT(datetime2, '12/31/2010') AS Result;
select @@version
Result...
2010-12-31 00:00:00.0000000
Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
Feb 10 2012 19:39:15
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
Kindly check your version...,
June 16, 2016 at 8:27 am
I'd tried the function within a database that had been restored into 2014 from a 2008 instance, so the compatibility level (100) of that database was set too low. When I tried the function in another database on the same 2014 server, a database that had been created within that 2014 instance, it worked.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy