I have a basic SQL query, starting with:
SELECT top 20 application_id, [name], location_id FROM apps
Now, I would like to finish it so that it
While it is not exactly a best practice to use 1=1, it does the trick here.
SELECT top 20 application_id, [name], location_id FROM apps WHERE (@lid > 0 and @lid = location_id) or (isnull(@lid, 0) <= 0 and 1=1)