sql server realtime scenario part 7 | how to check login credential in sql server
Channel: SS UNITECH
Date: 2021-06-16

How to check first time login in sql server
How to validate login in stored procedure in sql server

------Script for Stored Procedure----------

Create Proc sproc_ValidateLoginUsers
@LoginID Varchar(1000),
@Password Varchar(1000)
AS
BEGIN
DECLARE @FLAG INT=0

IF Exists (Select 1 from LoginDetails
     Where cast(DECRYPTBYPASSPHRASE('ssunitech',LoginID_H) as Varchar(1000)) =@LoginID
     AND cast(DECRYPTBYPASSPHRASE('ssunitech',password) as Varchar(1000))=@Password
     AND flag is null
     AND @Password='ssunitech@123')
Begin
Set @FLAG=1
GOTO SSU
END

IF Exists (Select 1 from LoginDetails
     Where cast(DECRYPTBYPASSPHRASE('ssunitech',LoginID_H) as Varchar(1000)) =@LoginID
     AND cast(DECRYPTBYPASSPHRASE('ssunitech',password) as Varchar(1000))=@Password
     )
Begin
Set @FLAG=2
GOTO SSU
END
SSU:
Select  @FLAG as Status
END

Find Us On YouTube- "Subscribe Channel to watch Database related videos"          https://www.youtube.com/channel/UCZA_5vGtSpZu86VBDdSnSag

For SQL Quiz-
https://www.youtube.com/watch?v=IaDXFyZSo7Y&list=PLNRxk1s77zfitFbrlRICVDgVodMr25mYl
 
Find Us On FaceBook-
https://www.facebook.com/SS-Unitech-187705388674384/