vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Here's my stored procedure: CREATE PROCEDURE proc @id varchar(50),@pswd varchar(20),@no_go int OUTPUT AS SET NOCOUNT ON SELECT user_id FROM table WHERE user_id=@id AND pswd=@pswd IF @@ROWCOUNT = 0 BEGIN SET @no_go = 1 END ELSE BEGIN SELECT date,date_mod FROM ans WHERE user_id=@id SET @no_go = 0 END This statement outputs the second recordset (SELECT FROM ans) whether @@ROWCOUNT is 0 or not. Why is that and how do I stop it |
| |||
| cliff@walkacrossfire.com (Cliff) wrote in message news:<54dc6fb1.0401272055.73b948c9@posting.google. com>... > Here's my stored procedure: > > CREATE PROCEDURE proc > @id varchar(50),@pswd varchar(20),@no_go int OUTPUT > AS > SET NOCOUNT ON > SELECT user_id FROM table > WHERE user_id=@id AND pswd=@pswd > IF @@ROWCOUNT = 0 > BEGIN > SET @no_go = 1 > END > ELSE > BEGIN > SELECT date,date_mod FROM ans > WHERE user_id=@id > SET @no_go = 0 > END > > This statement outputs the second recordset (SELECT FROM ans) whether > @@ROWCOUNT is 0 or not. Why is that and how do I stop it There's nothing obviously wrong there (or at least when I quickly tried a similar proc it worked for me) - have you used the debugger to verify that @@ROWCOUNT really is 0 at that point? And have you removed anything from your sample code that comes between the first SELECT and the IF statement? Simon |
| |||
| the procedure works fine in query analyzer, but in PERL, using DBI, it returns records past the if statemment, even if not true. Doen't a stored procedure die, if the conditions aren't met? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
| |||
| also, since PERL can pull in the data past an if statement, isn't that a security problem? The stored procedure has got to die *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
| ||||
| cliff rubin <cliff@walkacrossfire.com> wrote in message news:<40179cfc$0$70304$75868355@news.frii.net>... > the procedure works fine in query analyzer, but in PERL, using DBI, it > returns records past the if statemment, even if not true. Doen't a > stored procedure die, if the conditions aren't met? > > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! If the procedure works in QA, then there's no good reason for it to return different results when called from a different client. Unless somehow the DBI interface is doing something strange to the input, so that what is passed in from DBI is not the same as what is passed in from QA, but that's an entirely uninformed guess. I suspect you will get a better answer in a Perl or DBI forum. Simon |