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)
 Error with 0 passed to a search

Author  Topic 

SimonGough
Starting Member

23 Posts

Posted - 2002-01-15 : 06:39:20

Hi, I am searching a table using a stored proc. The search is always done via an ID reference but the user may also want to add an order code (e.g. 1000533) to the search. This number is passed into the SP as an int as well as being stored in this datatype.

The problem I am getting is that if the user doesn't enter an order code (they just select the ID reference they want), the main ID search is being set up ok but 0 is being passed for the order code and thus producing no results. How can I get around this problem???

Thanks...


smccreadie
Aged Yak Warrior

505 Posts

Posted - 2002-01-15 : 07:00:43
Without seeing some code, I'm guessing at what you're doing. But I think that if you set the order code to Null if one is not entered might do the trick.

Another option is using an IF ... ELSE statement to fire off a different search depending on what the user has input.

Go to Top of Page

SimonGough
Starting Member

23 Posts

Posted - 2002-01-15 : 07:12:52
Ok, I will try that. Thanks....

Go to Top of Page
   

- Advertisement -