<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1671249158308857862</id><updated>2011-11-28T00:23:44.278+01:00</updated><category term='SQL2008'/><category term='SSIS'/><category term='SQL Administration'/><title type='text'>SQL Server Area</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-5962134130845236818</id><published>2009-08-11T16:58:00.000+02:00</published><updated>2009-08-11T17:12:02.104+02:00</updated><title type='text'>SQL Traces mixing SQLServer2005 - 2008</title><content type='html'>Today was expiriencing some problem opening a Trace File:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Unable to locate trace definition file Microsoft SQL Server TraceDefinition 10.0.0.xml for open trace file... &lt;/strong&gt;It took me more than 10 min to figure out that the server I was profiling (Using SQLServer 2005 profiler) was a SQLServer 2008. :-p&lt;br /&gt;&lt;br /&gt;So you can trace a SQLServer 2008 using a SQLServer 2005 Profiler, but you cannot re-open the same traces using a SQLServer 2005 profiler, you have to use a SQLServer 2008 Profiler instead!&lt;br /&gt;&lt;br /&gt;Or if you don't have the 2008 tools installed yet on your locale machine, you can use:&lt;br /&gt;&lt;br /&gt;select * &lt;br /&gt;from fn_trace_gettable('\\share\...\TestTrc.trc',default)&lt;br /&gt;&lt;br /&gt;It works fine on both SQLServer 2005 and SQLServer2008 SSMS to connect to a SQLServer2005 or SQLServer2008 trace.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-5962134130845236818?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/5962134130845236818/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=5962134130845236818&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5962134130845236818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5962134130845236818'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2009/08/sql-traces-mixing-sqlserver2005-2008.html' title='SQL Traces mixing SQLServer2005 - 2008'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-8253525315994125697</id><published>2009-08-07T13:22:00.000+02:00</published><updated>2009-08-07T14:02:54.227+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>Fatal error 8646 occurred when performing an "ALTER PARTITION FUNCTION"</title><content type='html'>Today I was just doing some tests to create a partitioned table with a sliding window on an existing table.&lt;br /&gt;&lt;br /&gt;So I created my partition function and partition scheme, and did a drop index with move to my partition scheme on the existing table. Everithing (selects, inserts,...) worked well, until I wanted to Alter my Partition function to do an extra RANGE SPLIT. Than I did get a &lt;strong&gt;Fatal Error 8646&lt;/strong&gt;... error message. Fortunately, I remembered some problems with indexes and replication from the past who gave the same "8646" error message. And when looking at the table, I saw there was also an existing non-clustered index. After I dropped the non-clustered index, the problem was solved.&lt;br /&gt;&lt;br /&gt;I tried to reproduce the same error with a smaller table, but didn't get any "succes".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-8253525315994125697?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/8253525315994125697/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=8253525315994125697&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/8253525315994125697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/8253525315994125697'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2009/08/fatal-error-8646-occurred-when.html' title='Fatal error 8646 occurred when performing an &quot;ALTER PARTITION FUNCTION&quot;'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-2916014842309822900</id><published>2009-08-05T14:45:00.000+02:00</published><updated>2009-08-05T14:50:59.715+02:00</updated><title type='text'>SQLServer Parameter sniffing</title><content type='html'>We had an issue in two of our stored procedures recently with query execution plan caching. After digging deep in the code base we found what was causing the problem. &lt;br /&gt;&lt;br /&gt;One of the great features in SQL Server is its optimizing query processor. There are, however, times when some of the advanced features of the optimizer can cause problems. Sometimes it simply helps too much. One of those is when it automatically uses the parameter values passed into a stored procedure to tailor the execution plan it will construct for a query. This is called "parameter sniffing" and is normally a good thing. It allows the optimizer to take into account the actual values of stored procedure parameters as it builds plans to service queries within the procedure that make use of them. IOW, if you pass a value of "test" for a parameter named @param, then use @param in the WHERE clause of a query within the procedure, the optimizer is smart enough to use "test" when it estimates how many rows will match the WHERE clause as it compiles a plan for the query.&lt;br /&gt;While parameter sniffing is certainly a powerful feature, it can cause problems when a procedure’s plan happens to have been kicked out of the procedure cache (or was never in it) just prior to the procedure being called with atypical parameter values. This can result in a plan that is skewed toward atypical use, one that is suboptimal (or even downright slow) when called with typical values. Since, once cached, a query plan can be reused for parameter values that vary widely, the ideal situation is to have a plan in the cache that covers the typical usage of the procedure as much as possible. If a plan makes it into the cache that is oriented toward atypical parameter values, it can have a devastating effect on performance. &lt;br /&gt;SQL Server 2005 has some features to help combat this, but there are no built-in features for dealing with it in prior releases. There are three simple tricks that you can use to solve this problem:&lt;br /&gt;&lt;br /&gt;- the use of "decoy variables”. This means that we filter the query on a local variable value; witch replaces the parameter that we actually pass into the procedure.&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE usp_avoidSniff1(@param int) &lt;br /&gt;AS &lt;br /&gt;&lt;br /&gt;  BEGIN &lt;br /&gt;   Decalre @lclVarParam int&lt;br /&gt; &lt;br /&gt;   SET  @lclVarParam = @param&lt;br /&gt; &lt;br /&gt;   SELECT x, y&lt;br /&gt;   FROM MyTable &lt;br /&gt;   WHERE z = @lclVarParam &lt;br /&gt;  END &lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;- Filter the query on a dummy parameter, i.e. @template_param, that we never actually pass into the procedure. We always pass in the filter value we want to use via @param and let @template_param retain its default. The optimizer notices that we’re filtering the query against the sales table using @template_param and sniffs its value (which will always be the default value at compilation time) when creating the query plan for it.&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE usp_avoidSniff2(@param int, @param_def int= ‘My optim val’) &lt;br /&gt;AS &lt;br /&gt;&lt;br /&gt;  BEGIN &lt;br /&gt;&lt;br /&gt;   SET @param_def = @param&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;   SELECT x, y&lt;br /&gt;   FROM MyTable &lt;br /&gt;   WHERE z = @param_def &lt;br /&gt;  END &lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;- Use the OPTIMIZE FOR statement (SQLServer 2005). Adding this to a query makes sure the plan is optimized for the value you specify. And when all else fails you can even force a particular query plan with the new USE PLAN statement&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE usp_avoidSniff1(@param int) &lt;br /&gt;AS &lt;br /&gt;&lt;br /&gt;  BEGIN &lt;br /&gt; &lt;br /&gt;    SELECT x, y&lt;br /&gt;    FROM MyTable &lt;br /&gt;WHERE z = @param OPTION(OPTIMIZE FOR (@IDate = Null))&lt;br /&gt;&lt;br /&gt;  END &lt;br /&gt;&lt;br /&gt;GO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-2916014842309822900?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/2916014842309822900/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=2916014842309822900&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2916014842309822900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2916014842309822900'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2009/08/sqlserver-parameter-sniffing.html' title='SQLServer Parameter sniffing'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-2723110593912695948</id><published>2009-07-28T10:44:00.000+02:00</published><updated>2009-07-28T10:49:01.439+02:00</updated><title type='text'>SQLServer Locking and deadlocks</title><content type='html'>In SQLServer environments with a lot of concurrency, locks, blocks and deadlocks are a very common issue.&lt;br /&gt;&lt;br /&gt;To avoid negative performance impact, here are some best practices and monitoring tools to use:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1)      Use of WITH (NOLOCK)&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Where applicable, use &lt;strong&gt;WITH (NOLOCK)&lt;/strong&gt; in the FROM-clause and in JOIN. It avoids locks on the database while performing read-operations.&lt;br /&gt;Even when retrieving a value for values of local parameters inside a stored procedure, use the &lt;strong&gt;WITH (NOLOCK)&lt;/strong&gt; statement.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;SELECT x.a&lt;br /&gt;                , y.b&lt;br /&gt;                , …&lt;br /&gt; FROM dbo.MyTableX AS x &lt;strong&gt;WITH (NOLOCK)&lt;br /&gt;&lt;/strong&gt;                INNER JOIN dbo.MyTableY As y &lt;strong&gt;WITH (NOLOCK)&lt;br /&gt;&lt;/strong&gt;                                ON …..&lt;br /&gt;&lt;br /&gt;The NOLOCK keyword instructs SQL Server not to wait until any exclusive locks are gone. This improves concurrency on the database but, a resultset might contain data that have not been committed.&lt;br /&gt;&lt;br /&gt;In rare cases we can encounter this scenario:&lt;br /&gt;Query session A starts to change data for a in table X. Milliseconds later session B starts to read these data with the WITH (NOLOCK) option. Data, as changed by session A are shown to user B. But then user A cancels his action and the transaction is rolled back. At this point user B can see data on his screen that have not been committed.&lt;br /&gt;To avoid problems with uncommitted data (dirty reads) we should not use the WITH (NOLOCK) option when retrieving data that will be used in calculations and batches or on reports.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2)      Always check that the columns in your WHERE-clause are covered by an index.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If your statement takes more than 1 second, use the sp_lock command in SQL Server to check on exclusive locks (X)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3)       Use of Cursors&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Do not use cursors in Stored Procedures. They are too expensive for the DB performance. But sometimes are cursors required.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4)       Keep transactions short&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Put only the strictly necessary commands in the same transaction, and split up all commands in as much transactions as possible!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5)       During transactions, don't allow any user input. Collect it before the transaction begins.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;6)       Execute inserts/ updates on the same tables in the same order to avoid deadlocks.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;7)       Choose your clustered index wisely:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;a.       Choose a very narrow index which is very unique&lt;br /&gt;&lt;br /&gt;b.       If the clustered index contains more then 1 column, place them in the right “fine graining” order.&lt;br /&gt;&lt;br /&gt;c.        Avoid lock escalations during the update&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;8)       Avoid page splits:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;a.       Use a correct fillfactor&lt;br /&gt;b.       Again choose your clustered index wisely!!!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;9)       Use the right monitoring tools when necessary:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;a.       Profiler traces (DeadLocks + DeadLock chains + Deadlock Graph, lock timeouts).&lt;br /&gt;&lt;br /&gt;b.       Trace flags: To help identify which tables or stored procedures are causing deadlock problems, turn on trace flag 1204 (outputs basic trace data) or trace flag 1205 (outputs more detailed trace data).&lt;br /&gt;&lt;br /&gt;DBCC TRACEON (3605,1204,-1)&lt;br /&gt;&lt;br /&gt;Be sure to turn off this trace flag when you are done, as this trace can eat up SQL Server's resources unnecessarily, hurting performance.&lt;br /&gt;&lt;br /&gt;10)    &lt;strong&gt;Change the default deadlock behavior when appropriate&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can this by using the following command:&lt;br /&gt;&lt;br /&gt;SET DEADLOCK_PRIORITY { LOW  NORMAL  @deadlock_var }&lt;br /&gt;&lt;br /&gt;WHERE:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Low&lt;/strong&gt; tells SQL Server that the current session should be the preferred deadlock victim, not the session that incurs the least amount of rollback resources. The standard deadlock error message 1205 is returned.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Normal&lt;/strong&gt; tells SQL Server to use the default deadlock method.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;@deadlock_var&lt;/strong&gt; is a character variable specifying which deadlock method you want to use. Specify "3" for low, or "6" for normal.&lt;br /&gt;&lt;br /&gt;This command is set a runtime for a specified user connection&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-2723110593912695948?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/2723110593912695948/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=2723110593912695948&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2723110593912695948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2723110593912695948'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2009/07/sqlserver-locking-and-deadlocks.html' title='SQLServer Locking and deadlocks'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-9023528661613736370</id><published>2008-05-16T13:30:00.000+02:00</published><updated>2008-05-16T13:55:11.434+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><title type='text'>SSIS debugging on 64</title><content type='html'>&lt;strong&gt;Problem&lt;/strong&gt;: When I debug my SSIS package (which imports an Excel-sheet into SQLServer) on a 64-bit server, I get this errors:&lt;br /&gt;[Excel Source [9]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.&lt;br /&gt;&lt;br /&gt;[Connection manager "Excel Connection Manager"] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available.  Source: "Microsoft JET Database Engine"  Hresult: 0x80004005  Description: "The Microsoft Jet database engine cannot open the file ''.  It is already opened exclusively by another user, or you need permission to view its data.".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cause&lt;/strong&gt;: There is no 64 bit driver for excel. The workaround is to run the package using the 32 bit version of the execution utility.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution&lt;/strong&gt;: Project Properties-&gt;Degugging Section, I set Run64bit RunTime to False.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-9023528661613736370?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/9023528661613736370/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=9023528661613736370&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/9023528661613736370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/9023528661613736370'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/05/ssis-debugging-on-64.html' title='SSIS debugging on 64'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-2608818359818080970</id><published>2008-05-06T15:42:00.000+02:00</published><updated>2008-05-06T15:52:44.231+02:00</updated><title type='text'>Rebuild Master --&gt; back to RTM</title><content type='html'>If you rebuild the master database in SQL Server 2005, it reverts to the RTM version, losing service packs and additonal patches.&lt;br /&gt;&lt;br /&gt;The "strange" thing is that the server net libraries remain the original service pack versions, wich can be confusing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-2608818359818080970?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/2608818359818080970/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=2608818359818080970&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2608818359818080970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2608818359818080970'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/05/rebuild-master-back-to-rtm.html' title='Rebuild Master --&gt; back to RTM'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-1197223881693863158</id><published>2008-05-06T14:31:00.000+02:00</published><updated>2008-05-06T15:18:37.214+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>sp_MSforeachtable and sp_MSforeachdb</title><content type='html'>How simple can things be?&lt;br /&gt;&lt;br /&gt;I just discovered these "undocumented" sp's. No more cursor creations for these kind of queries ;-). In combination with all those dbcc and dm_... statements and views (i.e. DBCC CLEANTABLE), a good thing to know.  They both work in 2000 and 2005 (in 2005 there is no extra filtering on schema level :-s )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;USE AdventureWorks&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;EXEC sp_MSforeachtable 'select ''?'',count(*) from ?'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DECLARE @command varchar(1000)&lt;br /&gt;SELECT @command = 'USE ? SELECT name FROM sysobjects WHERE xtype = ''U'' ORDER BY name'&lt;br /&gt;&lt;br /&gt;EXEC sp_MSforeachdb @command&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-1197223881693863158?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/1197223881693863158/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=1197223881693863158&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/1197223881693863158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/1197223881693863158'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/05/spmsforeachtable-and-spmsforeachdb.html' title='sp_MSforeachtable and sp_MSforeachdb'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-2695991902168922590</id><published>2008-04-25T10:55:00.000+02:00</published><updated>2008-04-25T11:10:32.755+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>Linked Server failure for IBM OLE DB Providers on SQLServer2005 X64 Cluster</title><content type='html'>I've Created Linked servers to IBM AS400 machines using the IBMDA400 and IBMSQL400 OleDb providers. If I failover, or take off-line and bring back on-line the SQL Resource Group, I get this Error:&lt;br /&gt;&lt;br /&gt;Msg 7340, Level 16, State 4, Line 1&lt;br /&gt;Cannot create a column accessor for OLE DB provider "IBMDA400" for linked server "ATCOAIRC".&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;- Browse in the Management Studio to the linked Server, request the properties, and close this window again everytime SQLServer Service starts ;-)&lt;br /&gt;&lt;br /&gt;Or, if you don't want to do this manually - Duhhh...&lt;br /&gt;&lt;br /&gt;- USE master;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;EXEC sp_configure 'show advanced option', '1';&lt;br /&gt;RECONFIGURE&lt;br /&gt;&lt;br /&gt;EXEC sp_configure 'scan for startup procs', '1';&lt;br /&gt;RECONFIGURE&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE PROC usp_enum_oledb_providers&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;exec sp_enum_oledb_providers&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;exec sp_procoption N'usp_enum_oledb_providers', 'startup', 'on'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note: I didn't have this problem with SQLServer or Oracle Linked Servers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-2695991902168922590?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/2695991902168922590/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=2695991902168922590&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2695991902168922590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2695991902168922590'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/04/linked-server-failure-for-ibm-ole-db.html' title='Linked Server failure for IBM OLE DB Providers on SQLServer2005 X64 Cluster'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-6184640087753726081</id><published>2008-04-11T10:50:00.000+02:00</published><updated>2008-04-11T11:22:36.435+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>IBM Ole DB error in SQLServer 2005 on x64</title><content type='html'>&lt;strong&gt;Error:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Msg 7399, Level 16, State 1, Line 2&lt;br /&gt;The OLE DB provider "IBMDA400" for linked server "(null)" reported an error. Access denied.&lt;br /&gt;Msg 7350, Level 16, State 2, Line 2&lt;br /&gt;Cannot get the column information from OLE DB provider "IBMDA400" for linked server "(null)".&lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)&lt;br /&gt;--&gt; An exception occured while executing a Transact statement or batch.&lt;br /&gt;      --&gt; Cannot obtain the required interface ("IID_IDBSchemaRowset") from OLE DB Provider "IBMDA400" for linked server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;1) Make sure on your SQL Server 2005 x64 (64 bit) machine that "&lt;strong&gt;Allow inprocess&lt;/strong&gt;" is checked for the linked server provider (IBMDASQL in my case).&lt;br /&gt;--&gt; In SQL Mgmt Studio, connect to the SQL Server Database Engine and go to Server Objects-&gt;Linked Server-&gt;Providers in the Object Explorer.&lt;br /&gt;--&gt; Right-click on IBMDASQL and select Properties. Check the "Allow inprocess" box in the Provider Options dialog that comes up.&lt;br /&gt;&lt;br /&gt;2) Enable Ole Automation Procedures;&lt;br /&gt;&lt;br /&gt;sp_configure 'show advanced options', 1;&lt;br /&gt;GO&lt;br /&gt;RECONFIGURE;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;sp_configure 'Ole Automation Procedures', 1;&lt;br /&gt;GO&lt;br /&gt;RECONFIGURE;&lt;br /&gt;GO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-6184640087753726081?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/6184640087753726081/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=6184640087753726081&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/6184640087753726081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/6184640087753726081'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/04/ibm-ole-db-error-in-sqlserver-2005-on.html' title='IBM Ole DB error in SQLServer 2005 on x64'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-5940081103148200350</id><published>2008-04-04T10:10:00.000+02:00</published><updated>2008-04-04T10:15:24.661+02:00</updated><title type='text'>fn_my_permissions</title><content type='html'>Returns a list of the permissions effectively granted to the principal on a securable.&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;A. Listing&lt;strong&gt; &lt;/strong&gt;effective permissions on the &lt;strong&gt;server&lt;br /&gt;&lt;/strong&gt;The following example returns a list of the effective permissions of the caller on the server.&lt;br /&gt;&lt;br /&gt;SELECT * FROM fn_my_permissions(NULL, 'SERVER');&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;B. Listing effective permissions on the &lt;strong&gt;database&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of the caller on the AdventureWorks database.&lt;br /&gt;&lt;br /&gt;USE AdventureWorks;&lt;br /&gt;SELECT * FROM fn_my_permissions (NULL, 'DATABASE');&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;C. Listing effective permissions on a &lt;strong&gt;view&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of the caller on the vIndividualCustomer view in the Sales schema of the AdventureWorks database.&lt;br /&gt;&lt;br /&gt;&lt;a class="copyCode" tabindex="0" href="javascript:CopyCode("&gt;&lt;/a&gt;USE AdventureWorks;&lt;br /&gt;SELECT * FROM fn_my_permissions('Sales.vIndividualCustomer', 'OBJECT')&lt;br /&gt;ORDER BY subentity_name, permission_name ;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;D. Listing effective permissions of &lt;strong&gt;another user&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of database user Wanida on the Employee table in the HumanResources schema of the AdventureWorks database. The caller requires IMPERSONATE permission on user Wanida.&lt;br /&gt;&lt;br /&gt;&lt;a class="copyCode" tabindex="0" href="javascript:CopyCode("&gt;&lt;/a&gt;EXECUTE AS USER = 'Wanida';&lt;br /&gt;SELECT * FROM fn_my_permissions('HumanResources.Employee', 'OBJECT')&lt;br /&gt;ORDER BY subentity_name, permission_name ;&lt;br /&gt;REVERT;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;E. Listing effective permissions on a &lt;strong&gt;certificate&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of the caller on a certificate named Shipping47 in the current database.&lt;br /&gt;&lt;br /&gt;&lt;a class="copyCode" tabindex="0" href="javascript:CopyCode("&gt;&lt;/a&gt;SELECT * FROM fn_my_permissions('Shipping47', 'CERTIFICATE');&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;F. Listing effective permissions on an &lt;strong&gt;XML Schema Collection&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of the caller on an XML Schema Collection named ProductDescriptionSchemaCollection in the AdventureWorks database.&lt;br /&gt;&lt;br /&gt;&lt;a class="copyCode" tabindex="0" href="javascript:CopyCode("&gt;&lt;/a&gt;USE AdventureWorks;&lt;br /&gt;SELECT * FROM fn_my_permissions('ProductDescriptionSchemaCollection',&lt;br /&gt;'XML SCHEMA COLLECTION');&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;G. Listing effective permissions on a &lt;strong&gt;database user&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of the caller on a user named MalikAr in the current database.&lt;br /&gt;&lt;br /&gt;&lt;a class="copyCode" tabindex="0" href="javascript:CopyCode("&gt;&lt;/a&gt;SELECT * FROM fn_my_permissions('MalikAr', 'USER');&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;H. Listing effective permissions of &lt;strong&gt;another login&lt;/strong&gt;&lt;br /&gt;The following example returns a list of the effective permissions of SQL Server login WanidaBenshoof on the Employee table in the HumanResources schema of the AdventureWorks database. The caller requires IMPERSONATE permission on SQL Server login WanidaBenshoof.&lt;br /&gt;&lt;br /&gt;&lt;a class="copyCode" tabindex="0" href="javascript:CopyCode("&gt;&lt;/a&gt;EXECUTE AS LOGIN = 'WanidaBenshoof';&lt;br /&gt;SELECT * FROM fn_my_permissions('AdventureWorks.HumanResources.Employee', 'OBJECT')&lt;br /&gt;ORDER BY subentity_name, permission_name ;&lt;br /&gt;REVERT;&lt;br /&gt;GO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-5940081103148200350?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/5940081103148200350/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=5940081103148200350&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5940081103148200350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5940081103148200350'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/04/fnmypermissions.html' title='fn_my_permissions'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-3605137484762080580</id><published>2008-04-04T09:47:00.000+02:00</published><updated>2008-04-04T09:48:30.401+02:00</updated><title type='text'>Windows Vista and Office 2007 Compatibility</title><content type='html'>SQL Server &lt;strong&gt;Service Pack 2&lt;/strong&gt; or greater is needed to be fully compatible with Windows Vista and Microsoft Office 2007.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-3605137484762080580?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/3605137484762080580/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=3605137484762080580&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/3605137484762080580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/3605137484762080580'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/04/windows-vista-and-office-2007.html' title='Windows Vista and Office 2007 Compatibility'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-1420705495913559478</id><published>2008-03-28T01:34:00.000+01:00</published><updated>2008-03-27T17:34:13.327+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>Login "error States" in SQL Log</title><content type='html'>States                   Description&lt;br /&gt;&lt;br /&gt;2 and 5                 Invalid userid  &lt;br /&gt;6                            Attempt to use a Windows login name with SQL Authentication  &lt;br /&gt;7                            Login disabled and password mismatch  &lt;br /&gt;8                            Password mismatch  &lt;br /&gt;9                            Invalid password&lt;br /&gt;11 and 12              Valid login but server access failure  &lt;br /&gt;13                          SQL Server service paused  &lt;br /&gt;18                          Change password required&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-1420705495913559478?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/1420705495913559478/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=1420705495913559478&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/1420705495913559478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/1420705495913559478'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/03/login-error-states-in-sql-log.html' title='Login &quot;error States&quot; in SQL Log'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-2567452624843568990</id><published>2008-03-27T12:24:00.000+01:00</published><updated>2008-03-27T13:18:03.789+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>SQL Server Management Studio takes a long time to load, how to improve the load performance of this tool?</title><content type='html'>In general the SQL Server Management Studio takes at least 10 to 15 seconds to load on a user machine. Sometimes the SSMS tool can take a long time to load when there are a lot of SQL Server instances, this problem may also occur on the new 64-bit SQL Server 2005 platform.&lt;br /&gt;One resolution is to add a switch to the Management Studio shortcut as defined below. Access the below screen by going to Start &gt; Programs &gt; SQL Server 2005 program group &gt; 'SQL Server Management Studio' program, right-clicking will get you the following screen by opening the General tab, then select shortcut tab to add '&lt;strong&gt;nosplash&lt;/strong&gt;' switch:&lt;br /&gt;&lt;br /&gt;Also the user needs to tweak the Internet Explorer security settings as follows:&lt;br /&gt;Uncheck two options in Internet Explorer's Advanced Security settings. Namely:&lt;br /&gt;"&lt;strong&gt;Check for publisher's certificate revocation&lt;/strong&gt;"&lt;br /&gt;"&lt;strong&gt;Check for server certificate revocation&lt;/strong&gt;".&lt;br /&gt;Both these steps combined should improve the load time of SQL Server Management Studio.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-2567452624843568990?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/2567452624843568990/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=2567452624843568990&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2567452624843568990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2567452624843568990'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/03/sql-server-management-studio-takes-long.html' title='SQL Server Management Studio takes a long time to load, how to improve the load performance of this tool?'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-5277683615271811470</id><published>2008-03-26T13:13:00.000+01:00</published><updated>2008-03-26T13:30:49.070+01:00</updated><title type='text'>How to debug T-SQL stored procedures in SQLServer 2005</title><content type='html'>We will debug our procedure, &lt;strong&gt;not&lt;/strong&gt; from Management Studio but from the &lt;strong&gt;Visual Studio 2005&lt;/strong&gt; (only Team Systems or Professional editions) development environment. I mention this because under SQL Server 2000 we are able to debug stored procedures using Query Analyzer. Perhaps debugging capabilities will be added to Management Studio in the future. &lt;br /&gt;Before any debugging can take place, you first must create the store procedure. This can be done either by using Management Studio/New Query or by building the procedure graphically in Visual Studio 2005. Stored procedures can be created in Visual Studio by opening a new database project and using the &lt;a href="http://msdn2.microsoft.com/en-us/library/6db0hwky.aspx"&gt;Visual Studio Installed Templates&lt;/a&gt;.&lt;br /&gt;Either way, once the procedure exists, you are ready to start debugging from Visual Studio 2005. When you start up Visual Studio for debugging purposes, you don't have to create a project. Instead, you can create a connection to your database from Server Explorer (You will have to provide your server name along with your login credentials and choose the AdventureWorks database.) Then you can drill down and open up the stored procedures folder. Next, right click on the procedure you wish to debug and choose Step Into Stored Procedure from the context menu. Then you are ready to start debugging!&lt;br /&gt;&lt;br /&gt;Note: Before you can start "Remote debugging", you have to install "msvsmon.exe" from the visual studio CD or the sqlserver directory "C:\Program Files\Microsoft SQL Server\90\Shared\1033\rdbgsetup.exe".&lt;br /&gt;&lt;br /&gt;Micorosft development team is looking to implement a better way within SQL Server 2008 and as of now 2005 is only way out with Visual Studio.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-5277683615271811470?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/5277683615271811470/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=5277683615271811470&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5277683615271811470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5277683615271811470'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/03/how-to-debug-t-sql-stored-procedures-in.html' title='How to debug T-SQL stored procedures in SQLServer 2005'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-5157142644524201330</id><published>2008-03-26T13:08:00.000+01:00</published><updated>2008-03-26T13:09:55.962+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>Moving msdb</title><content type='html'>&lt;p&gt;Moving MSDB is more complicated than other system databases and requires you to add trace flags and parameters to the SQL Server startup to detach msdb, then remove them and restart SQL Server to attach it:&lt;/p&gt;&lt;p&gt;Start SQL Server with -c, -m and -T3608 and then perform a detach. You would then remove these parameters before attaching MSDB.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-5157142644524201330?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/5157142644524201330/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=5157142644524201330&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5157142644524201330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/5157142644524201330'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/03/moving-msdb.html' title='Moving msdb'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-1708922950995691615</id><published>2008-03-21T09:20:00.000+01:00</published><updated>2008-03-21T09:26:30.495+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Administration'/><title type='text'>Moving System Databases</title><content type='html'>If you are moving system databases (master, msdb, model, tempdb), you would change the location of &lt;strong&gt;master&lt;/strong&gt; by changing the startup parameters, bringing down the instance, and moving the master.mdf and master.ldf files.&lt;br /&gt;Secondly you need to address the &lt;strong&gt;model&lt;/strong&gt; database, because tempdb is reallocated every time the instance starts. This reallocation requires the existence of model to be successful.&lt;br /&gt;The last one you have to re-address is the msdb, because msdb is used by the SQL Server agent and has no bearing on the stability of the database engine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-1708922950995691615?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/1708922950995691615/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=1708922950995691615&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/1708922950995691615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/1708922950995691615'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/03/moving-system-databases.html' title='Moving System Databases'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1671249158308857862.post-2322257123376592597</id><published>2008-03-20T17:20:00.000+01:00</published><updated>2008-03-20T17:22:40.890+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL2008'/><title type='text'>Hierarchyid Travesal (SQLServer2008)</title><content type='html'>In which type of tree traversal would all nodes at a particular level below the root be traversed before those at lower levels?&lt;br /&gt;&lt;br /&gt;Given a tree such as this:&lt;br /&gt;       1&lt;br /&gt;    /  \&lt;br /&gt;   2 3 4&lt;br /&gt; / \ / \ \&lt;br /&gt;5 6 7  8  9&lt;br /&gt;&lt;br /&gt;a traversal of nodes in 1-2-3-4-5 order would be a &lt;strong&gt;breadth-first&lt;/strong&gt; traversal.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1671249158308857862-2322257123376592597?l=sqlarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlarea.blogspot.com/feeds/2322257123376592597/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1671249158308857862&amp;postID=2322257123376592597&amp;isPopup=true' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2322257123376592597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1671249158308857862/posts/default/2322257123376592597'/><link rel='alternate' type='text/html' href='http://sqlarea.blogspot.com/2008/03/hierarchyid-travesal-sqlserver2008.html' title='Hierarchyid Travesal (SQLServer2008)'/><author><name>Egon Vandenrijdt</name><uri>http://www.blogger.com/profile/17366254188434203611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
