Mahesh Babu

Mahesh Babu

  • 1.7k
  • 118
  • 8.8k

stored procedure in sqlserver

Aug 22 2018 3:35 AM
How to check the condition 
 
this is my sp
 
how to check the id is null in the sp  
 
alter PROCEDURE Check_Exist
(
@Id INT,
@balance money
)
AS
BEGIN
If @Id is null
IF NOT EXISTS (SELECT AccountId FROM Account WHERE [AccountId]=@Id)
BEGIN
INSERT INTO Account VALUES(@Id,@balance)
PRINT 'New Record Insert Successfuly'
END
ELSE
BEGIN
PRINT 'Id All Ready Exist'
END
END
 
please help me this  
 

Answers (3)