Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic. multiple, search parameter

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-10 : 09:41:22
Green writes "I'm trying to build a query where a user can pass any parameter (e.g. order id, name, or payment date). And sometimes would not enter the entire value for a field (e.g. Order ID = '53' instead of '533331'.

So, I read about your examples using Coalesce but it does not seem to work if i use 'LIKE' instead of '='."

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-10 : 10:22:00
did you try


select *
from table
where Order_ID like coalesce(@Order_ID, Order_ID) + '%'



KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-10 : 12:52:36
Also search about Dynamic Search in Article's section

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -