ALTER PROC [dbo].[SP_Contact_Msg]
--@Reg_id as int,
@Email as varchar(50),
@txtName as varchar(50),
@txtBody as varchar(50),
@MsgType as varchar (20)
As
BEGIN
Declare @Reg_Id as int
Declare @DriverReg_id as int
set @Reg_Id= (select top 1 Reg_ Id from reg where Email=@Email)
set @DriverReg_id= (select top 1 DriverReg_id from DriverReg where Email=@Email)
if @Reg_id IS NOT NULL AND @DriverReg_id IS NOT NULL
BEGIN
INSERT INTO Contact(
Reg_id,
DriverReg_id,
Email,
txtName,
txtBody,
MsgType,
CreatedOn,
CreatedBy,
UpdatedBy,
UpdatedOn,
IsActive)
values
(
@Reg_id
,@DriverReg_id
,@Email
,@txtName
,@txtBody
,@MsgType
,GETDATE()
,1
,null
,null
,1)
End
else
BEGIN
INSERT INTO Contact(
Reg_id,
DriverReg_id,
Email,
txtName,
txtBody,
MsgType,
CreatedOn,
CreatedBy,
UpdatedBy,
UpdatedOn,
IsActive)
values
(
null,
@Email,
@txtName,
@txtBody,
@MsgType,
GETDATE(),
1,
null,
null,
1)
End
End
Loading

ketan borsdiyaRank #2,258 · 624 reputationPosted Jul 10, 2016, 8:40 PM EDT
kalu singh raoRank #884 · 2.4K reputationPosted Jul 10, 2016, 9:31 PM EDT
Nilesh SawardekarRank #648 · 3.7K reputationPosted Jul 12, 2016, 4:47 AM EDT