Search code examples
sql-serverssmssql-server-2014

TRY_CAST is not a recognized built-in function name


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.

Built-In Function

Edited to Add: Sql Server Management Studio version. SQL Server Management Studio 2014


Solution

  • 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.