Debugging in SQL:
Create proc Sp_player
@id int,
@belongsTo varchar(50)
as
begin
select * from tbl_Players where PlayerID=@id and BelongsTo=@belongsTo
end
Step 1 :- Create one table for testing, Here we have one table tbl_Players .
Step 2 :- Create one stored procedure with some parameter.
Procedure Script :
@id int,
@belongsTo varchar(50)
as
begin
select * from tbl_Players where PlayerID=@id and BelongsTo=@belongsTo
end
Step 3:- Open new query window, and write below query with stored procedure name and parameter.
Here we are passing two parameter in stored procedure, Id & belongsTo
exec Sp_player 1,'India'
In above query 1 is first parameter value and India is second parameter value.
Now put breakpoint(Press F9) before exec Sp_player 1,'India' , see above image for reference.
Step 4:- Now Press F11 to start debugging mode. After Press F11 you will see below window .
Step 5:- Now Press F10 for step by step debugging. And at the end of execution they will return output .
In simple way :
- Write storedprocedure name with parameter :- exec Sp_player 1,'India'
- Put Breakpoint(Press F9)
- Press F11 to start debugging mode in SQL
- Press F10 for Step by Step debugging
- Return debugging Result
No comments:
Post a Comment