I have a puzzle with regards to the behavior of the SQL Server Management Studio. I am connected to a SQL Server database - version:
Microsoft SQL Server 2014 (SP1-CU3) (KB3094221) - 12.0.4427.24 (X64)
Oct 10 2015 17:18:26
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
When I run the following query from management studio, it returns me the correct output.
SELECT TRY_CAST('ax' AS decimal)
SELECT TRY_CAST('4.0' as decimal)
However the built-in editor gives me a message saying this function is not recognized.
Edited to Add: Sql Server Management Studio version.
It is available from sql server 2012. Check
select @@version
Also check the compatibility mode of the database
select name, compatibility_level from sys.databases
If compatibility mode is less that 110 then make it to >=110 by using alter database
alter database yourdatabasename set compatibility_level = 120
It's just an intellisense error. For some reason MS haven't included try_cast in SSMS 2014, although it's recognised as a valid function in SSMS 2016.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With