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.
Author |
Topic |
fpendino
Starting Member
5 Posts |
Posted - 2009-11-03 : 12:20:23
|
Hi,I have a stored proc which I'm using for a user login and it contains output parameters. I can not retreive the output paramters. This is just a test retrieval but here is what I have.DECLARE @curSession varchar(100)DECLARE @ERR varchar(300)DECLARE @DONE bitexec spLoginUser 'TESTUser', 'TestPass', '00', '123', @ERR, @DONE, @CurSessionSelect @curSession, @ERR, @DONEThe varibles are supposed to retrive the output parameters. They display NULL. I've tried setting the output parameters by using SELECT @OutputParam and SET @OutputParam..I know it is assigning the value to all output parameters because when I do a select from within the spLoginsUser Stored Proc, it does output the correct info. Just not when I try to retrieve the parameters when calling from another stored proc(like above). I'm using SQL 2000 and here are bits of the SQL code from spLoginUser.set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[spLoginUser] -- Add the parameters for the stored procedure here(@UserName varchar(10),@Password varchar(20),@IPAddress varchar(20),@SessionID varchar(100),@ErrorString varchar(100) output,@Success bit output,@CurrentSession varchar(100) output)ASBEGINSET NOCOUNT ON;DECLARE @UserActive bit DECLARE @WebApplicationUserID intDECLARE @PasswordVerified bit DECLARE @CurrentSessionID varchar(100)--Check to see if user exists and is active.. Removed code for thisIF @UserActive = 1BEGIN IF @PasswordVerified = 1BEGINSET @Success = 1SET @CurrentSession = 'TEST1234'ENDENDSELECT @Success, @CurrentSession --This returns a set of the correct dataENDThat is basically the idea of what I am doing, minus some of the bits of code.. |
|
fpendino
Starting Member
5 Posts |
Posted - 2009-11-03 : 12:21:58
|
Is there something I have to do to enable Output Parameters? |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2009-11-03 : 12:47:07
|
[code]exec spLoginUser 'TESTUser', 'TestPass', '00', '123', @ERR OUTPUT, @DONE OUTPUT, @CurSession OUTPUT[/code] |
|
|
fpendino
Starting Member
5 Posts |
Posted - 2009-11-03 : 13:03:48
|
Thank You! I did figure that out finally but I'm trying to retrieve these values in ASP.net and I think it is a separate issue. I was using this for testing purposes though.Thanks Again! |
|
|
|
|
|
|
|