SQLServer調試


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 = 1;  
set @j = 2;  
select @k=@i + @j  
exec sp_getOrders 10248   --調用存儲過程,自動進入斷點
 select @i;  
go 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM