Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

query sql:ottieni tutti i record in base a flag

Puoi farlo usando OPPURE:

SELECT * FROM Person WHERE Status = @Status OR @Status IS NULL

O UNION TUTTI:

SELECT * FROM Person WHERE Status = @Status
UNION ALL
SELECT * FROM Person WHERE @Status IS NULL