Hi All
This is related to another query I have posted but is a significantly different question and thus worthy of its own thread.
I am using a Front End that allows most querying TSQL terms but not DEFINE, SET, UPDATE and similar.
I have a query as below that works fine until I insert that penultimate IIF statement in it, causing the front end to say 'Invalid column name 'Alpha', invalid column name 'Beta'.
Have I broken TSQL rules or might this be a limitation of the front end system I am using?
Thanks,
Tombo
select
addressline1,
iif(charindex(',',addressline1)=0 OR charindex(',',addressline1) IS NULL, NULL, left(addressline1,charindex(',',addressline1)-1)) AS Alpha,
iif(charindex(' ',addressline1)=0 OR charindex(' ',addressline1) IS NULL, NULL, left(addressline1,charindex(' ',addressline1)-1)) AS Beta,
IIF(Alpha IS NULL, Beta, Alpha)
from contact