Question: I have an SQL function which returns a list of files
now I should join an additional list to that list with an union, but only if the user is admin.
Is that possible? Something like:
CREATE FUNCTION tfu_CMS_Process(@bIsAdmin bit )
-- Add the parameters for the function here
RETURNS TABLE
AS
RETURN
(
SELECT * FROM TABLE1
UNION
if bIsAdmin
SELECT * FROM TABLE2
end if
)