Link to home
Start Free TrialLog in
Avatar of Glen_D
Glen_D

asked on

Not getting a return output variable on SP

When I run this sp, just stating that sp executed instead of displaying result.  Need the value returned.

Exec usp_CheckPWDate


ALTER PROCEDURE [dbo].[usp_CheckPWDate]
@User_Login varchar(50) = test12345,
@User_Password varchar (50) = test9,
@RetStatus tinyint = NULL output
 
as
 
set nocount on
 
declare @password_date datetime
declare @password_check int
declare @userID int
 
select @password_date =  Date_PW_Change from tbl_User
where user_login=@user_login and userID = @UserID
 
Set @password_check = DATEDIFF(day, @password_Date, getdate())
 
if @password_check < 84
   set @retstatus=0
else if @password_check between 85 and 90
   set @retstatus=1
else
   set @retstatus=2
Avatar of chapmandew
chapmandew
Flag of United States of America image

show me how you're calling your stored procedure.
Avatar of Glen_D
Glen_D

ASKER

I have a developer who is coding in Cold Fusion...when a user logs on, he calls this sp to check for pw expiration...

Thx
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Glen_D

ASKER

yes but even when I pass values, I'm not getting a return code...thx
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Glen_D

ASKER

OK...great....I keep getting a 2 now when the PW Date is today 2/13...any ideas?

Thx
i guess it depends on the year you're passing in as well as your system date on yoru machine.
Avatar of Glen_D

ASKER

The datediff call is working fine....
what values are you passing to it?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Glen_D

ASKER

2/11/2009 12:00:00 AM = Date_PW_Changed
What about this?

select DATEDIFF(day, '2009-02-13', getdate())
Avatar of Glen_D

ASKER

returns 0 - which is good

that's what I need outputted
Avatar of Glen_D

ASKER

password age = NULL
It will return 0 if the Date_PW_Change is any time in the future and as far back as 83 days.
It will return 1 if the Date_PW_Change is 85 to 90 days old.
It will return 2 if the Date_PW_Change is 91 days old or greater.

if @password_check < 84
   set @retstatus=0
else if @password_check between 85 and 90
   set @retstatus=1
else
   set @retstatus=2