18
Domanda: Ho una funzione SQL che restituisce un elenco di fileSQL unione condizionale
ora dovrei aderire un ulteriore elenco a quella lista con un'unione, ma solo se l'utente è admin.
È possibile? Qualcosa di simile:
CREATE FUNCTION tfu_CMS_Process(@bIsAdmin bit )
-- Add the parameters for the function here
RETURNS TABLE
AS
RETURN
(
SELECT * FROM TABLE1
if bIsAdmin
UNION ALL
SELECT * FROM TABLE2
end if
)
Stavo per suggerire l'uso di una tabella temporanea, ma questa è la vera risposta. – cjk
@Quassnoi: lascia un po 'per noi, eh? :) –
'@OMG Ponies': hai avuto l'intera settimana! – Quassnoi