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)
 Making the WHERE clause one large variable

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-04 : 10:36:03
Paul13 writes "I have a series of 20 queries that are similar except some have more criteria in the WHERE clause. is there a simple way of dealing with this?

example:

q1: SELECT code FROM table WHERE name = 'bill'

q2: SELECT code FROM table WHERE name = 'fred' and job = 'trucker'

q3: SELECT code FROM table WHERE name = 'willy' and job LIKE '%sales'

q4: SELECT code FROM table WHERE name LIKE 'b%' and zip LIKE '9%'

obviously this is a simplified example. using the same stored procedure is required for ASP simplicity.

Can i simply make the entire 'WHERE' clause one long variable string?

How else can I stick different relations in to a single WHERE clause?

"
   

- Advertisement -