I am new to TSQL. I need to write a stored procedure that returns filtered records. Thus, the user has two dates to enter. He can enter only one date, or two, or both.
In saved proc I have two parameters @From, @To - date type. I need to search for entries.
If the user did not enter dates, I do not need dates in the select request.
If the user entered 2 dates - I need to search for them inclusively.
If the user entered the date @From - I need to search until today inclusive.
If the user entered the date @ - I need to search for dates less than @To.
Thank you for your help.
source
share