<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Roman Rehak</title><subtitle type="html" /><id>http://sqlblog.com/blogs/roman_rehak/atom.aspx</id><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/default.aspx" /><link rel="self" type="application/atom+xml" href="http://sqlblog.com/blogs/roman_rehak/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61129.1">Community Server</generator><updated>2007-04-24T15:03:00Z</updated><entry><title>Synonyms and SQL Server Express</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx</id><published>2008-05-03T03:37:00Z</published><updated>2008-05-03T03:37:00Z</updated><content type="html">&lt;P&gt;I've been a big fan of using SQL Server aliases for a long time because it allows you to make physical location of SQL Servers transparent to the client machines. With SQL Server 2005 Microsoft introduced synonyms, allowing you to define logical names for objects in another database or even on another server. This could be among other things beneficial if you need to move some tables to another database. Instead of recoding your application, you can define synonyms and point them to the new location (I wrote an &lt;A class="" href="http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1281621,00.html" target=_blank&gt;article&lt;/A&gt; for SearchSQLServer.com about synonyms recently, you can get more details there if interested) This week I realized that synonyms can have another great benefit. As you know, SQL Server Express has a limit of 4GB per database. If your database begins to grow close to 4GB, you can move one or more large tables to another database on the same server, create synonyms in the original database and point them to the new location. I tested it on my SQL Server Express instance and it does work as expected. So with this knowledge, this limitation might become less of an obstacle for you to consider SQL Server Express.&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Synonyms and SQL Server Express&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Synonyms and SQL Server Express%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx" target="_blank" title = "Email Synonyms and SQL Server Express"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx&amp;amp;title=Synonyms+and+SQL+Server+Express" target="_blank" title = "Submit Synonyms and SQL Server Express to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx&amp;amp;phase=2" target="_blank" title = "Submit Synonyms and SQL Server Express to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx&amp;amp;title=Synonyms+and+SQL+Server+Express" target="_blank" title = "Submit Synonyms and SQL Server Express to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx&amp;amp;title=Synonyms+and+SQL+Server+Express" target="_blank" title = "Submit Synonyms and SQL Server Express to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2008/05/03/synonyms-and-sql-server-express.aspx&amp;amp;title=Synonyms+and+SQL+Server+Express&amp;amp;;top=1" target="_blank" title = "Add Synonyms and SQL Server Express to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=6607" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author><category term="SQL Server Express" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/SQL+Server+Express/default.aspx" /><category term="Synonyms" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/Synonyms/default.aspx" /></entry><entry><title>Granting EXECUTE on all stored procedures</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx</id><published>2008-01-16T22:39:00Z</published><updated>2008-01-16T22:39:00Z</updated><content type="html">&lt;P&gt;I came across this a few months ago when I was researching security in 2005 and now thought it would be useful to post it here. I have saved code that loops through all stored procedures in the database and grants execute privileges to a database user. I've had&amp;nbsp;it around&amp;nbsp;since SQL Server 7.0. Now I discovered that in SQL Server 2005 you can create a server role and grant it EXECUTE privileges on all stored procedures. This solution is much more elegant, plus I don't have to rerun my script if I add more procs:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE:14pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- create custom database role&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:14pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;CREATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:14pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;ROLE&lt;/SPAN&gt; db_executor&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:14pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:14pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- grant EXECUTE permission&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:14pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;GRANT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:14pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;EXECUTE&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;TO&lt;/SPAN&gt; db_executor&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:14pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:14pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--&amp;nbsp;add security&amp;nbsp;account to the role&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:14pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;exec&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:14pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:maroon;"&gt;sp_addrolemember&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'db_executor'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'YourSecurityAccount'&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Note - security account can be a database user,&amp;nbsp;database&amp;nbsp;role,&amp;nbsp;a Windows login or Windows group.&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Granting EXECUTE on all stored procedures&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Granting EXECUTE on all stored procedures%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx" target="_blank" title = "Email Granting EXECUTE on all stored procedures"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx&amp;amp;title=Granting+EXECUTE+on+all+stored+procedures" target="_blank" title = "Submit Granting EXECUTE on all stored procedures to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx&amp;amp;phase=2" target="_blank" title = "Submit Granting EXECUTE on all stored procedures to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx&amp;amp;title=Granting+EXECUTE+on+all+stored+procedures" target="_blank" title = "Submit Granting EXECUTE on all stored procedures to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx&amp;amp;title=Granting+EXECUTE+on+all+stored+procedures" target="_blank" title = "Submit Granting EXECUTE on all stored procedures to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2008/01/16/granting-execute-on-all-stored-procedures.aspx&amp;amp;title=Granting+EXECUTE+on+all+stored+procedures&amp;amp;;top=1" target="_blank" title = "Add Granting EXECUTE on all stored procedures to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=4564" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author><category term="Tips" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/Tips/default.aspx" /></entry><entry><title>DevTeach/SQLTeach follow-up</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx</id><published>2007-12-02T07:50:00Z</published><updated>2007-12-02T07:50:00Z</updated><content type="html">&lt;P&gt;I just got back from Vancouver where I was attending/presenting at the &lt;A class="" href="http://www.sqlteach.com/" target=_blank&gt;SqlTeach&lt;/A&gt; conference. There were other speakers from sqlblog as well - &lt;A class="" href="http://sqlblog.com/blogs/adam_machanic/default.aspx" target=_blank&gt;Adam Machanic&lt;/A&gt;, &lt;A class="" href="http://sqlblog.com/blogs/paul_nielsen/default.aspx" target=_blank&gt;Paul Nielsen&lt;/A&gt; and &lt;A class="" href="http://sqlblog.com/blogs/peter_debetta/default.aspx" target=_blank&gt;Peter DeBetta&lt;/A&gt;. This conference is a venture put on by Jean-Rene Roy and his wife Maryse from Montreal, it started as DevTeach in 2003&amp;nbsp;and this year the SQL Server track was marketed as a separate conference. This is the largest Microsoft conference in Canada and 2007 started a new 18 month rotation between Montreal, Vancouver and Toronto. Jean-Rene and Maryse did a great job as always, which is even more admirable and appreciated considering they just moved from Montreal to Ottawa. The next event will take place in Toronto, from May 12th to May 16th.&lt;/P&gt;
&lt;P&gt;I resurrected my SQL Server Tips and Tricks talk that I used to do in 2003/2004 and updated it with 2005 content. Just like before, attendees seemed to like my utility ScripExec for executing script files with some logging and error handling capabilities. I will add a couple of features I've been thinking about and release it through SqlBlog as a freeware. I will also look into the possibility of putting it on CodePlex and see if we can get other coders interested in enhancing it.&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=DevTeach/SQLTeach follow-up&amp;amp;body=Seen on SQLblog.com: %0A%0A%09DevTeach/SQLTeach follow-up%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx" target="_blank" title = "Email DevTeach/SQLTeach follow-up"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx&amp;amp;title=DevTeach%2fSQLTeach+follow-up" target="_blank" title = "Submit DevTeach/SQLTeach follow-up to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx&amp;amp;phase=2" target="_blank" title = "Submit DevTeach/SQLTeach follow-up to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx&amp;amp;title=DevTeach%2fSQLTeach+follow-up" target="_blank" title = "Submit DevTeach/SQLTeach follow-up to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx&amp;amp;title=DevTeach%2fSQLTeach+follow-up" target="_blank" title = "Submit DevTeach/SQLTeach follow-up to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/02/devteach-sqlteach-follow-up.aspx&amp;amp;title=DevTeach%2fSQLTeach+follow-up&amp;amp;;top=1" target="_blank" title = "Add DevTeach/SQLTeach follow-up to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=3621" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author><category term="Conference" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/Conference/default.aspx" /><category term="DevTeach" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/DevTeach/default.aspx" /><category term="SQLTeach" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/SQLTeach/default.aspx" /></entry><entry><title>How to rethrow errors in T-SQL</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx</id><published>2007-12-02T01:40:00Z</published><updated>2007-12-02T01:40:00Z</updated><content type="html">&lt;P&gt;If you do application development and you are used to rethrowing errors in a catch block, you may have noticed that error handling in T-SQL still doesn't support this functionality. However, you can easily emulate this functionality by rolling out your own "rethrow" stored procedure and using RAISERROR to throw the error back to the client. BOL contains a good example of that, there is a stored procedure called usp_RethrowError. It uses the built-in error functions and RAISERROR to create a new error with the same message text, number and other details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Here is the code:&lt;/P&gt;&lt;FONT size=+0&gt;
&lt;P&gt;CREATE PROCEDURE [dbo].[usp_RethrowError]&lt;BR&gt;AS -- Return if there is no error information to retrieve.&lt;BR&gt;IF ERROR_NUMBER() IS NULL &lt;BR&gt;&amp;nbsp; RETURN ;&lt;/P&gt;
&lt;P&gt;DECLARE @ErrorMessage NVARCHAR(4000),&lt;BR&gt;&amp;nbsp; @ErrorNumber INT,&lt;BR&gt;&amp;nbsp; @ErrorSeverity INT,&lt;BR&gt;&amp;nbsp; @ErrorState INT,&lt;BR&gt;&amp;nbsp; @ErrorLine INT,&lt;BR&gt;&amp;nbsp; @ErrorProcedure NVARCHAR(200) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Assign variables to error-handling functions that &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- capture information for RAISERROR.&lt;BR&gt;SELECT&amp;nbsp; @ErrorNumber = ERROR_NUMBER(), @ErrorSeverity = ERROR_SEVERITY(),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @ErrorState = ERROR_STATE(), @ErrorLine = ERROR_LINE(),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-') ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Building the message string that will contain original&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- error information.&lt;BR&gt;SELECT&amp;nbsp; @ErrorMessage = N'Error %d, Level %d, State %d, Procedure %s, Line %d, ' +&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Message: ' + ERROR_MESSAGE() ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Raise an error: msg_str parameter of RAISERROR will contain&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- the original error information.&lt;BR&gt;RAISERROR (@ErrorMessage, @ErrorSeverity, 1, @ErrorNumber, -- parameter: original error number.&lt;BR&gt;&amp;nbsp; @ErrorSeverity, -- parameter: original error severity.&lt;BR&gt;&amp;nbsp; @ErrorState, -- parameter: original error state.&lt;BR&gt;&amp;nbsp; @ErrorProcedure, -- parameter: original error procedure name.&lt;BR&gt;&amp;nbsp; @ErrorLine-- parameter: original error line number.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;BR&gt;GO&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=4&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=4&gt;&lt;FONT size=2&gt;Sample code showing how to use it:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=+0&gt;DECLARE @Zero INT&lt;BR&gt;SET @Zero = 0&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=+0&gt;BEGIN TRY&lt;BR&gt;&amp;nbsp;SELECT 5 / @Zero&lt;BR&gt;END TRY&lt;BR&gt;BEGIN CATCH&lt;BR&gt;&amp;nbsp;PRINT 'We have an error...'&lt;BR&gt;&amp;nbsp;EXEC usp_RethrowError&lt;BR&gt;END CATCH&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=How to rethrow errors in T-SQL&amp;amp;body=Seen on SQLblog.com: %0A%0A%09How to rethrow errors in T-SQL%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx" target="_blank" title = "Email How to rethrow errors in T-SQL"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx&amp;amp;title=How+to+rethrow+errors+in+T-SQL" target="_blank" title = "Submit How to rethrow errors in T-SQL to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx&amp;amp;phase=2" target="_blank" title = "Submit How to rethrow errors in T-SQL to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx&amp;amp;title=How+to+rethrow+errors+in+T-SQL" target="_blank" title = "Submit How to rethrow errors in T-SQL to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx&amp;amp;title=How+to+rethrow+errors+in+T-SQL" target="_blank" title = "Submit How to rethrow errors in T-SQL to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/12/01/how-to-rethrow-errors-in-t-sql.aspx&amp;amp;title=How+to+rethrow+errors+in+T-SQL&amp;amp;;top=1" target="_blank" title = "Add How to rethrow errors in T-SQL to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=3619" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author></entry><entry><title>DevTeach/SqlTeach 2007 followup</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx</id><published>2007-05-22T04:17:00Z</published><updated>2007-05-22T04:17:00Z</updated><content type="html">&lt;P&gt;As Peter DeBetta already &lt;A class="" href="http://sqlblog.com/blogs/peter_debetta/archive/2007/05/18/news-devteach-teched-and-sqlblog-sundries.aspx" target=_blank&gt;mentioned in his post&lt;/A&gt;, a few of SqlBlog-ers including myself were at the DevTeach/SqlTeach conference in Montreal. It was great to catch up with everybody and as always, there wasn't enough time to hang out with the fellow speakers, attend all the good sessions and enjoy the Montreal nightlife. Peter and I did a duet session called SQL Server 2005 Worst Practices. It was really a great talk and I want to thank Peter again for letting me join him in this session, originally developed by him and &lt;A class="" href="http://sqlblog.com/blogs/rhundhausen/default.aspx" target=_blank&gt;Richard Hundhausen&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;As the Tech Chair for SqlTeach, I was really pleased with the quality of the sessions, feedback from the attendees but especially much higher attendance than in the previous years. It's great to see that SQL Server is gaining momentum in Canada and we had quite a few FoxPro heads wanting to learn more about SQL Server while making the move to a new platform. I am sure SQL Server won't dissapoint them :-). And as always, Jean-Rene Roy and his wife Maryse (the husband-wife team behind the conference) did a&amp;nbsp;superb job as organizers and hosts. Why Jean-Rene is still not an MVP after all the work he has done for the Canadian developer and DBA community is beyond me. BTW, Next DevTeach/SqlTeach will be taking place in Vancouver this November.&lt;/P&gt;
&lt;P&gt;Also&amp;nbsp;- thanks to my friend Tom Cooley and Martin Lapierre you can find a detailed report about DevTeach on the &lt;A class="" href="http://www.utcoverage.com/DevTeach/2007/" target=_blank&gt;Universal Thread Coverage&lt;/A&gt; website.&amp;nbsp;The coverage&amp;nbsp;includes Peter's and my session.&amp;nbsp;&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=DevTeach/SqlTeach 2007 followup&amp;amp;body=Seen on SQLblog.com: %0A%0A%09DevTeach/SqlTeach 2007 followup%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx" target="_blank" title = "Email DevTeach/SqlTeach 2007 followup"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx&amp;amp;title=DevTeach%2fSqlTeach+2007+followup" target="_blank" title = "Submit DevTeach/SqlTeach 2007 followup to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx&amp;amp;phase=2" target="_blank" title = "Submit DevTeach/SqlTeach 2007 followup to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx&amp;amp;title=DevTeach%2fSqlTeach+2007+followup" target="_blank" title = "Submit DevTeach/SqlTeach 2007 followup to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx&amp;amp;title=DevTeach%2fSqlTeach+2007+followup" target="_blank" title = "Submit DevTeach/SqlTeach 2007 followup to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/22/devteach-sqlteach-2007-followup.aspx&amp;amp;title=DevTeach%2fSqlTeach+2007+followup&amp;amp;;top=1" target="_blank" title = "Add DevTeach/SqlTeach 2007 followup to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=1268" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author><category term="Conference" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/Conference/default.aspx" /></entry><entry><title>'ASP.NET session has expired'  error in the ReportViewer control</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx</id><published>2007-05-04T15:20:00Z</published><updated>2007-05-04T15:20:00Z</updated><content type="html">&lt;P&gt;I deployed an ASP.NET&amp;nbsp; application to another server and the page that includes a few ReportViewer controls started showing the "ASP.NET session has expired" error in each report. The same web app worked totally fine on my box. I didn’t have time to investigate before I moved on to other work and then a few days later I came across a solution to the problem by accident when reading a KB article related to RS security on WebHost4Life.com. They suggested changing the AsyncRendering property to false. Since there are some performance penalties when turning off asynchronous rendering, I decided to make it a setting in Web.config and turn it off only if needed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool asyncRendering = bool.Parse(ConfigurationManager.AppSettings.Get("AsyncRendering"));&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; rptvAverageOrder.ServerReport.ReportServerUrl = rsUrl;&lt;/P&gt;
&lt;P&gt;After I tried that, the error went away but I ended up with another issue. Reports with images (in my case charts) ended up having a missing image with that ugly placeholder with an X in it. I did some googling and found out that this can happen if asynchronous rendering in ReportViewer is off and the server name contains an underscore as it does in my case so these two issues are related. When I use the IP address or "localhost" in the URL, everything works fine regardless of how this property is set. Also, some people pointed out is that if you turn off asynchronous rendering, reports get messed up when viewed with Firefox. I will report this as an issue on Microsoft Connect and I guess in the meantime we have to avoid deploying ReportViewer applications on servers with underscores in their names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject='ASP.NET session has expired'  error in the ReportViewer control&amp;amp;body=Seen on SQLblog.com: %0A%0A%09'ASP.NET session has expired'  error in the ReportViewer control%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx" target="_blank" title = "Email 'ASP.NET session has expired'  error in the ReportViewer control"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx&amp;amp;title=%27ASP.NET+session+has+expired%27++error+in+the+ReportViewer+control" target="_blank" title = "Submit 'ASP.NET session has expired'  error in the ReportViewer control to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx&amp;amp;phase=2" target="_blank" title = "Submit 'ASP.NET session has expired'  error in the ReportViewer control to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx&amp;amp;title=%27ASP.NET+session+has+expired%27++error+in+the+ReportViewer+control" target="_blank" title = "Submit 'ASP.NET session has expired'  error in the ReportViewer control to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx&amp;amp;title=%27ASP.NET+session+has+expired%27++error+in+the+ReportViewer+control" target="_blank" title = "Submit 'ASP.NET session has expired'  error in the ReportViewer control to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/04/asp-net-session-has-expired-error-in-the-reportviewer-control.aspx&amp;amp;title=%27ASP.NET+session+has+expired%27++error+in+the+ReportViewer+control&amp;amp;;top=1" target="_blank" title = "Add 'ASP.NET session has expired'  error in the ReportViewer control to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=1212" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author><category term="Reporting Services" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/Reporting+Services/default.aspx" /><category term="ReportViewer" scheme="http://sqlblog.com/blogs/roman_rehak/archive/tags/ReportViewer/default.aspx" /></entry><entry><title>Why use "Included" columns in SQL Server 2005</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx</id><published>2007-05-03T15:15:00Z</published><updated>2007-05-03T15:15:00Z</updated><content type="html">&lt;P&gt;Recently I was working on an application where I got a lot of mileage out of using a new feature of SQL Server 2005 called included columns. When you add a column as an “included” column, it gets stored at the leaf level of the index and it is not part of the index key. This only works for non-clustered indexes.&lt;BR&gt;&lt;BR&gt;The main advantages of included columns are&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) You can exceed the 900 byte limitation of the index key, any columns that would push you over that limit could instead be added as included rather than key columns&lt;/P&gt;
&lt;P&gt;2) You can include datatypes that are not allowed as key columns, such as varchar(max), nvarchar(max) or XML. Note – you still cannot use the old datatypes such as text or ntext.&lt;/P&gt;
&lt;P&gt;3) You can greatly expand you options for creating covering index.&lt;/P&gt;
&lt;P&gt;4) You can reduce the size of the index to make it more efficient by including only lookup columns in the key, and then adding other query covering columns as included columns &lt;BR&gt;&amp;nbsp;&lt;BR&gt;As always, you should use some judgment. If you include four varchar(max) columns and they contain a lot of data, the size of your index will be huge. Also, since each column will be maintained in the table and in the index, updating large columns will slow down the application somewhat. Below is a sample CREATE INDEX script that indexes the Title column and includes a varchar(max) column called Content:&lt;/P&gt;
&lt;P&gt;CREATE NONCLUSTERED INDEX [IX_MyTable] ON [dbo].[MyTable] &lt;BR&gt;(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Title] ASC&lt;/P&gt;
&lt;P&gt;)&lt;BR&gt;INCLUDE ( [Content]) &lt;BR&gt;&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx" target="_blank" title = "Email Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx&amp;amp;title=Why+use+%26quot%3bIncluded%26quot%3b+columns+in+SQL+Server+2005" target="_blank" title = "Submit Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005 to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx&amp;amp;phase=2" target="_blank" title = "Submit Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005 to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx&amp;amp;title=Why+use+%26quot%3bIncluded%26quot%3b+columns+in+SQL+Server+2005" target="_blank" title = "Submit Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005 to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx&amp;amp;title=Why+use+%26quot%3bIncluded%26quot%3b+columns+in+SQL+Server+2005" target="_blank" title = "Submit Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005 to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/05/03/why-use-included-columns-in-sql-server-2005.aspx&amp;amp;title=Why+use+%26quot%3bIncluded%26quot%3b+columns+in+SQL+Server+2005&amp;amp;;top=1" target="_blank" title = "Add Why use &amp;quot;Included&amp;quot; columns in SQL Server 2005 to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=1198" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author></entry><entry><title>Problems when removing a filegroup</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx</id><published>2007-04-26T20:19:00Z</published><updated>2007-04-26T20:19:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;This week we ran into a weird problem. We were not able to remove an empty filegroup, SQL Server was throwing the 5042 error “The filegroup 'FG18' cannot be removed because it is not empty”. There were definitely no files in that filegroup so the whole thing appeared to be more like a bug. As it turns out, this can happen if a table that was using the filegroup had statistics defined on that filegroup. You can tell if you have any dangling statistics for that filegroup if you run this query and replace X with your filegroup ID:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;select object_name(id) AS TableName, * from dbo.sysindexes where groupid = X&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Once you know the table name, you can run DROP STATISTICS and hopefully after that you should be able to remove the filegroup.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Problems when removing a filegroup&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Problems when removing a filegroup%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx" target="_blank" title = "Email Problems when removing a filegroup"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx&amp;amp;title=Problems+when+removing+a+filegroup" target="_blank" title = "Submit Problems when removing a filegroup to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx&amp;amp;phase=2" target="_blank" title = "Submit Problems when removing a filegroup to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx&amp;amp;title=Problems+when+removing+a+filegroup" target="_blank" title = "Submit Problems when removing a filegroup to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx&amp;amp;title=Problems+when+removing+a+filegroup" target="_blank" title = "Submit Problems when removing a filegroup to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/26/problems-when-removing-a-filegroup.aspx&amp;amp;title=Problems+when+removing+a+filegroup&amp;amp;;top=1" target="_blank" title = "Add Problems when removing a filegroup to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=1186" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author></entry><entry><title>Change in trace flags behavior in SQL Server 2005</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx" /><id>http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx</id><published>2007-04-24T18:03:00Z</published><updated>2007-04-24T18:03:00Z</updated><content type="html">&lt;P&gt;The other day I was setting up trace flags when chasing a deadlock issue. The way it works is that after you run DBCC TRACEON, SQL Server outputs detailed log to the SQL Server event log. But for some reason this trace was just not showing. The only thing I could see in the event log was a message that DBCC TRACEON was executed, but nothing after that. I used Google and read some articles but still didn't find what the problem was. I went back to BOL and I finally noticed the reason why:&lt;/P&gt;
&lt;P&gt;"In SQL Server 2000, a simple DBCC TRACEON (1204) is enough to enable deadlock reporting to the error log. In SQL Server 2005, you must enable the flag globally because the session-level flag is not visible to the deadlock monitor thread."&lt;/P&gt;
&lt;P&gt;So as it turns out, it's a change in behavior from the previous version. Here is how you enable the trace globally:&lt;/P&gt;
&lt;P&gt;DBCC TRACEON (1204, -1);&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Change in trace flags behavior in SQL Server 2005&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Change in trace flags behavior in SQL Server 2005%0A%0Ahttp://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx" target="_blank" title = "Email Change in trace flags behavior in SQL Server 2005"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx&amp;amp;title=Change+in+trace+flags+behavior+in+SQL+Server+2005" target="_blank" title = "Submit Change in trace flags behavior in SQL Server 2005 to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx&amp;amp;phase=2" target="_blank" title = "Submit Change in trace flags behavior in SQL Server 2005 to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx&amp;amp;title=Change+in+trace+flags+behavior+in+SQL+Server+2005" target="_blank" title = "Submit Change in trace flags behavior in SQL Server 2005 to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx&amp;amp;title=Change+in+trace+flags+behavior+in+SQL+Server+2005" target="_blank" title = "Submit Change in trace flags behavior in SQL Server 2005 to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/roman_rehak/archive/2007/04/24/change-in-trace-flags-behavior-in-sql-server-2005.aspx&amp;amp;title=Change+in+trace+flags+behavior+in+SQL+Server+2005&amp;amp;;top=1" target="_blank" title = "Add Change in trace flags behavior in SQL Server 2005 to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=1179" width="1" height="1"&gt;</content><author><name>roman</name><uri>http://sqlblog.com/members/roman.aspx</uri></author></entry></feed>