Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2001-12-11 : 18:04:54
|
| I though I might share with SQLTeam my default Template for Debugging/testing work on SQL Server..Instructions:Save this text as "Something.tsql" (I call it Debug.tsl) and place in your "SQL Query Analyser Template " Directory.. (By Default "C:\Program Files\Microsoft SQL Server\80\Tools\Templates\SQL Query Analyzer")To load.. simply click the drop down on the "New" Icon and Select "Template.." Choose the Template.To change the Debug parameters press CTRL+SHIFT+M.I couldn't find a way to attach a file so it is in-line....Enjoy!!--Start of File/*Usefull SP'sEXEC SP_STORED_PROCEDURESEXEC SP_TABLESEXEC SP_HELPTEXT ' 'USE DBCC CHECKDBDBCC DBREINDEX (' ','',0)DBCC SHOWCONTING ( )DBCC SHOWCONTIG WITH TABLERESULTS, ALL_INDEXES --SQL2K ONLY*/--Flags for DB Commitment, Stats and Execution PlanDECLARE @bTransactions bitDECLARE @bStatistics bitDECLARE @bShowPlan bit--Set transaction, stats and show plan on/offSET @bTransactions = <Transactions, bit, 0> -- 0 = Commit to DB, 1 = RollBack TransactionsSET @bStatistics = <Statistics, bit, 0> -- 0 = Don't show stats, 1 = Show StatsSET @bShowPlan = <SHOW PLAN, bit, 0> -- 0 = Don't Show Plan, 1 = Show Plan without executingif @bTransactions = 1BEGIN SET IMPLICIT_TRANSACTIONS ON BEGIN TRANENDif @bStatistics = 1BEGIN SET STATISTICS TIME ON SET STATISTICS IO ONENDif @bStatistics = 1BEGIN SET SHOWPLAN_ALL ONEND--Enter Your SQL Below Here--Resetting Optionsif @bTransactions = 1BEGIN ROLLBACK TRAN SET IMPLICIT_TRANSACTIONS OFFENDif @bStatistics = 1BEGIN SET STATISTICS TIME OFF SET STATISTICS IO OFFENDif @bStatistics = 1BEGIN SET SHOWPLAN_ALL OFFEND--End of FileDavidMA database is a set of axioms, the response to a query is a theorem, the process of deriving the theorem from the axioms is a proof, a proof is made by manipulating symbols according to agreed mathematical rules.Edited by - byrmol on 12/11/2001 18:06:13 |
|
|
|
|
|
|
|