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)
 Simple Search

Author  Topic 

Nick
Posting Yak Master

155 Posts

Posted - 2001-11-12 : 16:24:57
I'm trying to do a simple search of my database, and am running into more problems than I thought I would.

To do the search I am using a stored procedure that looks like


CREATE PROCEDURE spOrderSearch


@orderID nvarchar(50),
@customerID nvarchar(50)

AS

SELECT tblOrders.orderID FROM tblOrders, tblBoxes
WHERE tblOrders.orderID=tblBoxes.orderID
AND tblOrders.orderID LIKE @orderID
AND tblOrders.customerID LIKE @customerID

GO


Unfortunetly, it isn't working so well. Both the customerID and orderID are int's in the database. If I try to use '%'s in the procedure i get errors.. Do I need to do this dynamically? If I don't have the % then the phrase has to be exact and not just a partial.

What am I doning wrong?

   

- Advertisement -