i've been trying to get TRY_CONVERT to work but it states its an unrecognized built in function for sql server 2012 (even though sql server *does* recognises it because i get it in the intellisense, and its not underlined as unrecognised)
i note that the compatibility mode for the database is sql server 2008 (100).
but surely that would mean IIF wouldn't work either? but that works fine.
reference: http://stackoverflow.com/questions/22310486/try-convert-fails-on-sql-server-2012
http://msdn.microsoft.com/en-us/library/hh230993.aspx
DECLARE @int INT = 1
DECLARE @varchar VARCHAR(50) = 'david'
SELECT
CASE WHEN TRY_CONVERT(INT,@varchar) IS NULL THEN 'failed' ELSE 'succeeded' END AS result
anyone see what i'm doing wrong?