ALTER PROC SP_Contact_Msg
--@Reg_id as int,
@Email as varchar(50),
@txtName as varchar(50),
@txtBody as varchar(50)
AS
BEGIN
DECLARE @Reg_Id AS INT
SET @Reg_Id = (SELECT TOP 1 Reg_Id FROM reg WHERE Email = @Email)
IF @Reg_id != NULL
BEGIN
INSERT INTO Contact ( Reg_id, Email, txtName, txtBody, CreatedOn, CreatedBy, UpdatedBy, UpdatedOn, IsActive)
values (@Reg_id, @Email, @txtName, @txtBody, GETDATE(), 1, NULL, NULL, 1)
END
IF @Reg_id = NULL
BEGIN
INSERT INTO Contact (Reg_id, Email, txtName, txtBody, CreatedOn, CreatedBy, UpdatedBy, UpdatedOn, IsActive)
VALUES (null, @Email, @txtName, @txtBody, GETDATE(), 1, NULL, NULL, 1)
END
END
please help me this procedure does not work correctly when i give email of register(reg) user email its not show the (reg_id) just show null, its only execute only else condition
Aucun commentaire:
Enregistrer un commentaire