Why does this throw an equal sign error?
select IIF((SUBSTRING('A1234', 1, 1) = 'A'), TRUE, FALSE) as IsAustraliaUser
Error:
Msg 102, Level 15, State 1, Line 1Invalid syntax near '='.
IIF is a feature of SQL Server 2012, you will need to use CASE
IIF
CASE
SELECT CASE SUBSTRING('A1234', 1, 1) WHEN 'A' THEN 'TRUE' ELSE 'FALSE' END
You must replace IIF with CASE, also TRUE and FALSE do not exist in SQL Server, you can use VARCHAR or BIT
select CASE WHEN SUBSTRING('A1234', 1, 1) = 'A' THEN 'TRUE' ELSE 'FALSE' END as IsAustraliaUser
I do not think SQL supports this IIF syntax (if you are not using 2012), replace it with a case.
SELECT CASE WHEN ( SUBSTRING('A1234', 1, 1) = 'A' ) THEN 'TRUE' ELSE 'FALSE' END AS IsAustraliaUser
Source: https://habr.com/ru/post/1502069/More articles:Module import in python not found - pythonCalling the liferay portlet as a web service with a REST API - restHaving difficulty interpreting a debugger using StringBuilder in C # - stringbuilderThe difference between a portlet and a web service - web-servicesInvalid source tag. Attributes must be separated by spaces. - htmlMethod completed, but has no effect - objectmatplotlib combines polar and cartesian gridded data - pythonunderstanding of a python dict with two ranges - pythonC # how to stop a thread in time? - multithreadingPHPUnit: Mocking a method that takes a parameter - phpAll Articles