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
 Transact-SQL (2000)
 Stored Procedure Problem

Author  Topic 

Outrider
Starting Member

2 Posts

Posted - 2008-07-14 : 15:40:57
I've got a problem with my stored procedures that I'm hoping someone can help me with.

I'm trying to select information from a table which has an Identity as a primary key (ShipperID), another unique integer which the office staff uses to identify the record (ShipperNo), and a bunch of information that doesn't matter in this situation.

I've written 2 stored procedures to select a record.

Here's the first, which searches by ShipperID:

CREATE PROCEDURE ShipperSelectByID
@ShipperID int
AS
BEGIN
SELECT * FROM tblShipper WHERE ShipperID = @ShipperID
END
GO

And here's the second, which searches by ShipperNo

CREATE PROCEDURE dbo.ShipperSelectByNo
(
@ShipperNo int
)
AS
BEGIN
SELECT * FROM tblShipper WHERE ShipperNo = @ShipperNo
END
GO

The problem is that they both select by ShipperID, even tho the second clearly says WHERE ShipperNo = @ShipperNo. Can anyone see something I'm missing?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-14 : 15:50:30
The first one is filtering via ShipperID, the second one is filtering via ShipperNo. If you aren't seeing this, then you aren't calling the correct stored procedure. Run the stored procedures inside Query Analyzer to see what they do.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Outrider
Starting Member

2 Posts

Posted - 2008-07-15 : 07:42:45
Turns out it was just stupidity on my part, problem wasn't even in SQL, sorry for wasting everyone's time.
Go to Top of Page
   

- Advertisement -