Cralis (admin@myschoolmates.com) writes:
Quote:
Lets say the user wants to find all helicopters using a Z80 motor. So,
he selects that from a drop down, and the rest remain as 'Select
one..'.
>
So I pass paramteres to my stored procedure....
>
sp_find_aircraft esc=0, motor=67, gyro=0, engine=0, servo=0
(67 being the ID of the component he wants to look up.. in this case,
the Z80 engine).
>
How do I create the where clause for this? My select looks like this:
There are a couple of options, and I have an article (in two versions) on
my web site that discusses this in detail:
http://www.sommarskog.se/dyn-search.html.
By the way, do not use the sp_ prefix for your stored procedures. This
prefix is reserved for system procedures.
--
Erland Sommarskog, SQL Server MVP,
esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx