• Đăng ký
  • Đăng nhập

sql check if parameter is null in where clause

📅 — 👀 31 — 👦
SELECT * FROM Thingies WHERE ThingID = isnull(@ThingId, ThingID)
--or
SELECT * FROM Thingies WHERE (@ThingId IS NULL OR ThingID = @ThingId)