I've the following query:
SELECT NAME, SURNAME FROM MY_TABLE WHERE NAME = ?;
Now I want that if '?' is NULL, all records have to be selected. How can I achieve this in SQL? Thanks
Try this:
SELECT * FROM MY_TABLE WHERE @parameter IS NULL OR NAME = @parameter;
1.4m articles
1.4m replys
5 comments
57.0k users