Guest User

Untitled

a guest
Aug 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. SQL Where Column1 = Column1 will only return non-nulls
  2. Select * from User where Country = Country
  3.  
  4. Select * from User where Country = coalesce(@Country, Country)
  5.  
  6. Select *
  7. from User
  8. where @Country is null or Country = @Country
  9. option (recompile)
  10.  
  11. IF @Country is null
  12. Select *
  13. from User
  14. ELSE
  15. Select *
  16. from User
  17. Where Country = @Country
Add Comment
Please, Sign In to add comment