推薦優秀的SQL腳本調試工具Embarcadero DBArtisan 可以調試SQL Server 2000/2005 SQL調試工具匯總


調試SQL語句是經常會碰到的需求,常常為了查找報表的數據是否正確,SQL腳本為什么取不到預想中的數據,一般都可以通過調試SQL語句來解決問題,找到原因。問題不一定是系統的Bug,可能是設置不正確,可能是數據之間沒有關聯。

看到園子里的一篇文章"介紹一款替代SSMS的sqlserver管理工具 toad for sqlserver5.7”,這個工具我最喜歡的功能當屬SQL語句調試,其它的功能,SSMS可以做到。SSMS對於SQL Server 2000/2005,無法進行腳本調試。

除了Toad for SQLServer可以解決問題外,我這里推薦Embarcadero DBArtisan,界面如下圖所示

image

界面中看到的,是在修復ERP的報表數據,更新當前正在驗貨的數據(采購驗貨,抽查驗貨,生產驗貨)到物料主文件中。

程序安裝完成后,打開它,它會枚舉當前局域網中的SQL Server實例,選擇需要的實例,打開一個腳本窗口,復制SQL語句片段到窗口中,再按Debgu窗口,即可開始調試。

調試問題時,可以在Watch窗口中看到被監視的變量的值,也可以把鼠標旋停在變量上查看它當前的值。

 

寫到這里,突然想到找一下市面上能看到的所有的SQL Debugger,以方便查找。經過努力的查找,又發現了工具

Aqua Data Studio可以Step Into,Step Over存儲過程和腳本片段。官網上有一段文字介紹,我把它復制到下面來

Debug AquaScripts within the Editor:  Just like Aqua Data Studio's DB2, MS SQL Server, Oracle and Sybase SQL debuggers, AquaScripts can be stepped through during execution to examine results and debug errors. Functions can be evaluated and parameters entered as the debugging process continues. Breakpoints can be set and used to pause execution to examine values and parameters. The debugger highlights the breakpoints, indicates which one currently pauses the execution and sets bookmarks in the navigation bar so that they can be viewed quickly when there are multiple pages worth of lines to debug.

  • Toggle a break point in the script body. A user can set a break point at any line in the source code in order to run it up to this line.
  • Running the script until the break point with parameters provided by the user. The execution can be stopped at any time using the stop button. Output messages for the execution can be viewed in the Console tab.
  • "Step Into","Step Over" and "Step Return" buttons allow the user to move through and execute functional blocks of the code.
  • Stack, Global Scope and Local Scope can be viewed in the Debug tab.
  • The user can enter variables and view their values during the execution in the Variables tab.
  • The user can enter expressions and see their values in the Watches tab.

Debug AquaScripts within a Web Browser:  When debugging in browser, the built-in HTTP server will provide an interface in a tab document within ADStudio. The interface will display the HTTP requests processed.  The HTTP requests include which scripts that are executed, with the parameter name value pairs that are passed to the executing script.

片段語句functional blocks of the code,可以通過此工具調試。非常抱歉,至今沒有在網內的網站上找到相關的下載和破解工具,無法截圖以證實它所說的功能。

 

再來看看每天編程用到的Visual Studio 2010。在VS2003時,它就可以做到連接到SQL Server中,調試存儲過程。對於片段SQL語句,可以簡單的封裝成存儲過程,再通過VS2003的強大調試功能實現腳本追蹤。

image

時間一下子就來到了2013年,10年前(2012)的技術到今天已經有了質的提升。SQL Server 2005引入了CLR,可以用熟悉的.NET語言編寫SQL Server Object,通常是Function,Procedure,也可以定義類型,比如緯度,貨幣(數量和幣種),復數。打開服務器管理器,選擇SQL實例,勾選Application Debugging,然后選中需要調試的存儲過程,填入值,即可開始追蹤過程。要注意使用Windows信任連接方式,否則會報錯

image

好了,這一下子又多出了5個同系列的SQL調試工具。從VS2003到VS2012,一共是五個出自微軟的SQL調試工具。

如果把SQL Server Management Studio 也算上,從SQL Server 2008, SQL Server 2008 R2, SQL Server 2012,一共有三個同系列的SQL調試工具。這樣一算,就有8個出自微軟的SQL工具,可以用來調試SQL腳本。

 

總結一下可以調試SQL語句的工具

  • Toad for SQLServer
  • Embarcadero DBArtisan
  • Microsoft Visual Studio 2003-2012
  • SQL Server Management Studio 2008-2012


免責聲明!

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



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