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)
 Newbie needs help?

Author  Topic 

JBelthoff
Posting Yak Master

173 Posts

Posted - 2001-07-28 : 15:20:48
I have the following stored procedure. However, when I run it the info from the first insert gets inserted however, the info from the second one does not.

Can someone please tell me what I am doing wrong.

Here is the Proc...

CREATE PROCEDURE IPG_NewAccount
@FName nvarchar(25),
@LName nvarchar(50),
@Email nvarchar(75),
@PWord nvarchar(20),
@RegIP nvarchar(15)

AS

IF EXISTS(SELECT A_EMail1
FROM IPG_ACCOUNTS
WHERE A_EMail1 LIKE LOWER(@Email))

BEGIN
Return(1)
END

ELSE

BEGIN
DECLARE @DateNow datetime
DECLARE @Ident int
SET @DateNow = GETDATE()
INSERT INTO IPG_ACCOUNTS(A_FName, A_LName, A_Email1, A_Password, A_RegisterDate, A_LastLoginDate, A_LastUpdateDate, A_RegisterIP, A_LastLoginIP)
VALUES(@FName, @LName, LOWER(@Email), @PWord, @DateNow, @DateNow, @DateNow, @RegIP, @RegIP)

SET @Ident = @@IDENTITY

INSERT INTO IPG_LISTINGS
(L_A_ID)
VALUES(@Ident)
Return(0)
END


I should mention that the return value gets returned properly so I know it is processing down to the return(0) statement.




Edited by - JBelthoff on 07/28/2001 16:01:02
   

- Advertisement -