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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 syntax problem

Author  Topic 

pjgadsdon
Starting Member

1 Post

Posted - 2001-09-28 : 05:49:32
I can seem to get this stored procedure's syntax right

Can any body Help

CREATE PROCEDURE spCheckUserName
@Username nvarchar(20),
@passwrd nvarchar(20),
@Error int OUTPUT
AS

IF EXISTS(SELECT * FROM users WHERE Username = @Username AND Passwrd = @passwrd)
BEGIN
IF (SELECT UserLastLoginDate FROM USERS) < getdate()
BEGIN
SELECT @Error = 0 --No errors
UPDATE Users
SET UserLastLoginDate = getdate()
ELSE
BEGIN
SELECT @Error = 1 --User has already logged in today
Return(@Error)
END
ELSE
BEGIN
Select @Error = 2 --wrong U/P combination
END
end

Return(@Error)


Thanls Paul

   

- Advertisement -