1、普通调试
直接点击SSMS客户端上的调试按钮即可
2、存储过程调试
2.1 定义存储过程(以Northwind数据库为例)
USE [Northwind]
GO
/****** Object: StoredProcedure [dbo].[sp_getOrders] Script Date: 2014/7/7 17:32:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_getOrders]
@orderID int = null
as
if (@orderID is null )
begin
print 'null'
end
else
begin
print 'correct'
end
select * from Orders where OrderID = @orderID
2.2 调试存储过程(直接点击SSMS上的调试按钮)
declare @i int ,@j int,@k int
set @i = ;
set @j = ;
select @k=@i + @j
exec sp_getOrders --调用存储过程,自动进入断点
select @i;
go