Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

where stmt=failure 2

Status
Not open for further replies.

dswitzer

Technical User
Aug 2, 2002
298
US
My sp (SQL2000) is very simple -- pulling data from a table based on an input paramater.

When I run the sp in Query Analyzer - it is fine. When I run it through ASP -- 0 records. That is the count - zero...no data whatsoever.

However, if I eliminate the where clause inside the sp and just grab the top 6 in the table -- ASP reads this.


Code:
CREATE PROCEDURE dbo.sixMoSum2 (@xID as varchar(20))
AS
SET NOCOUNT ON

DECLARE @maxQtrDt as datetime
SET @maxQtrDt = '2007-06-30'

-- this one reads as zero records in ASP
-- runs fine in Query Analyzer
Select * from galtmain.dbo.finquarterly_master where xID=@xID 

-- when I uncomment this line,it works and writes out in ASP
-- runs fine in Query Analyzer
--Select top 6 * from galtmain.dbo.finquarterly_master

This is a fairly new db and I am not a true admin - I have rechecked the settings, but it is possible I have missed something. Any ideas?


 
Code:
where xID=@xID
Only two possibilities I can see are:
1) Your ASP is not sending the correct value for @xID
or
2) xID is not a valid field name (or is mis-spelled) in your table.

Always remember that you're unique. Just like everyone else.
 
check to see what the asp is sending as the input paramenter

"NOTHING is more important in a database than integrity." ESquared
 
Wow -- so basic it is always the start of my debugging process...except this time.

The webguy is going to be ticked when I point the finger back at him -- um, I mean collaborate on team interaction and synergy to identify and solve the issue in a productive and non-threatening way.....

Slightly embarrassing - but I'm happy it's fixed. Thanks again.
 
Exactly what genomon and SQLsis thought -- wrong parameter being passed to SQL. The ASP guy was rewriting the system and overwrote the @xid paramater in some code. I ALWAYS make him print out the code he passes to SQL Server before I do any research to see if it is a SQL problem...except this time...lesson learned - again.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top