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 WHERE clause alternative.

Author  Topic 

Access
Starting Member

44 Posts

Posted - 2007-06-26 : 23:06:24
I have 3 tables: Authors, Employee and Stores.
I need to create a stored procedure which will take 3 comma delimited parameters, to be able to query above 3 tables.
Basically my front end user can say give me Authors with last name starting from ‘A,B’ and Employee with first name starting from ‘J,N,K’ and Stores with city starting from ‘New, Los’.
So, stored procedure call will look like this Exec myStoredProcedure 'A,B' , 'J,N,K', 'New,Los' .

My question is, how should I handle WHERE clause in stored procedure if I don’t want it to be a “dynamic WHERE”.

Thank you.

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-06-26 : 23:24:37
here's a good article on different strategies for dynamic search conditions: http://www.sommarskog.se/dyn-search.html

EDIT: i misread your post. lucky for me there's another of Erland's articles discussing arrays in sql: http://www.sommarskog.se/arrays-in-sql.html




elsasoft.org
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-27 : 00:31:01
Also refer
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm


Madhivanan

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

- Advertisement -