I have this structure inside a function:
INSERT INTO @TheTable
SELECT DISTINCT
@Number AS Number,
@Name AS Name
FROM MYTABLE
WHERE id = @id
I need to add to this structure the result of executing another function and I need your help to do so.
Below the @Name AS Name, line I should add something like this
IF (dbo.anotherFunction(@id)==1)
@NewVisitor AS NewVisitor
ELSE
@NewVisitor AS NoNewVisitor
How can I translate this into TSQL??
Thanks a million!