3
Answers

stored procedure in sqlserver

Photo of Mahesh Babu

Mahesh Babu

6y
811
1
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)