This is my stored procedure Chk_UserDetails
Create procedure [dbo].[Chk_UserDetails]
(
@p_userid varchar(20),
@p_password varchar(20),
@p_result int output
)
as
set nocount on
begin
if Exists(Select 1 from USER_MASTER where UM_USER_ID=@p_userid)
Begin
if exists(Select 1 from USER_MASTER where UM_USER_ID=@p_userid and UM_PASSWORD=@p_password)
Begin
if Exists(Select 1 from USER_MASTER where UM_USER_ID=@p_userid and UM_PASSWORD=@p_password and UM_STATUS='A')
begin
set @p_result = 1
Select UM_USER_NAME,UM_PASSWORD, from USER_MASTER where UM_USER_ID=@p_userid and UM_PASSWORD=@p_password
End
else
set @P_result = 2 -- in active
End
Else
set @p_result = -1 -- invalid password
End
Else
set @p_result = -2 -- invalid user
end
This is my Table
CREATE TABLE [dbo].[USER_MASTER](
[UM_USER_ID] [varchar](20) NOT NULL,
[UM_PASSWORD] [varchar](20) NOT NULL,
[UM_USER_NAME] [varchar](40) NOT NULL,
[UM_ADDRESS] [varchar](100) NULL,
[UM_PHNO] [varchar](20) NULL,
CONSTRAINT [PK_USER_MASTER] PRIMARY KEY CLUSTERED
(
[UM_USER_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UQ__USER_MASTER] UNIQUE NONCLUSTERED
(
[UM_USER_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
No comments:
Post a Comment