Plz help
How to write mulitiple queries in storedprocedure?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Raj KumarRank #25 · 44.2K reputationPosted Jul 20, 2008, 8:40 PM EDT
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
CREATE PROCEDURE [dbo].[ValidateUserLogin]
(
@Email varchar(300),
@PWD varchar(100),
@IPAddress varchar (20) = '',
@ReturnValue int out
)
AS
if exists(SELECT [Name] FROM Users WHERE Email = @Email AND Password = @PWD AND IsActive=1 )
Begin
UPDATE Users SET LastLogin = GetDate(), IPAddress = @IPAddress WHERE UserID = @UserID AND Password = @PWD
UPDATE [Security] SET IPAddress = @IPAddress WHERE EMailAddress = @Email
SELECT * FROM users WHERE Email = @Email AND Password = @PWD
End
if(@@Error<> 0)
BEGIN
RAISERROR ('Error in SP [ValidateUserLogin], Unable to Validate/Update the record.', 16,1)
Return
END
else
Set @ReturnValue = 0