A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
HI @kccrga ,
Welcome back to Microsoft Q&A!
Could you please help check above part of your query?
It seems that it might be as below:
new_time <=@new_time and amount >=@min_amount
You could use column=@paramter or @paramter is null as mentioned by other expert.
Or you could also use column =isnull(@paramter,column ) like below:
SELECT *
FROM [dbo].[transaction]
WHERE account_id =@account_id
and (old_time >=isnull(@old_time,old_time ) and new_time <=isnull(@new_time,new_time))
and (amount >=isnull(@min_amount,amount) and amount <=isnull(@max_amount,amount))
If above are not working, please post CREATE TABLE statements for your table ([dbo].[transaction]) together with INSERT statements with sample data, enough to illustrate all angles of the problem. We also need to see the expected result of the sample.
Best regards,
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.