<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dev Team Assemble &#187; SQL Server</title>
	<atom:link href="http://www.calvinirwin.net/tag/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.calvinirwin.net</link>
	<description>Evil beware!</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:55:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SELECT TOP n ROWS &#8211; DB2</title>
		<link>http://www.calvinirwin.net/2009/12/15/select-top-n-rows-db2/</link>
		<comments>http://www.calvinirwin.net/2009/12/15/select-top-n-rows-db2/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:53:17 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DB2]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=243</guid>
		<description><![CDATA[One thing I always seem to forget when moving from one db system to the other (not using DB2 all that often) is how to select the TOP n rows from a query.
In MS SQL Server this is expressed as SELECT TOP n * FROM [table] ...
the equivilent in DB2 is SELECT * FROM [table] FETCH [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I always seem to forget when moving from one db system to the other (not using DB2 all that often) is how to select the TOP n rows from a query.</p>
<p>In MS SQL Server this is expressed as SELECT TOP n * FROM [table] ...</p>
<p>the equivilent in DB2 is SELECT * FROM [table] FETCH FIRST n ROWS ONLY</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/DB2' rel='tag' target='_self'>DB2</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/12/15/select-top-n-rows-db2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Shrink Logs and Custom Backup Script</title>
		<link>http://www.calvinirwin.net/2009/08/24/sql-server-shrink-logs-and-custom-backup-script/</link>
		<comments>http://www.calvinirwin.net/2009/08/24/sql-server-shrink-logs-and-custom-backup-script/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 17:07:24 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DBCC Shinkfile]]></category>
		<category><![CDATA[logfile]]></category>
		<category><![CDATA[shink]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=165</guid>
		<description><![CDATA[A little while ago I was having a problem with MS SQL Server 2005, It was ballooning my log files and not recovering space after a backup and I posted a fix for this here.  The only issue I had left at that point was rolling it into a complete solution that can be run [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago I was having a problem with MS SQL Server 2005, It was ballooning my log files and not recovering space after a backup and I posted a fix for this <a href="http://www.calvinirwin.net/2009/07/26/operation-aborted-exception-from-hresult-0x80004004-e_abort/">here</a>.  The only issue I had left at that point was rolling it into a complete solution that can be run on the server and does not require being run manually.  The following script I put together can run as a Job (or as a SQL task in a Maintenance plan) and will backup all of the databases on your server with the exception of the system db's (master, msdb, temp, model) .  There are also sections in the script to add your own exclusions in case you want to remove long running backups or databases that do not require this sort of treatment, search for <strong>DB_2EXCLUDE. </strong></p>
<p>NOTE: The word press plug-in for code formatting changes my greater than and less than sign into &amp;gt; and &amp;lt; respectivly so you will need to change this back if copying the code....until i figure it out anyway.</p>
<pre class="oracle8"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @dbExt <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @logExt <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @backupLocation <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DATE</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @tempFile <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @tempPath <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold; text-transform: uppercase;">MAX</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @lasterror int
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @mailprofile <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @mail_rec <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">-- cursor vars</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @dbname <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @dbid int
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @recModel int
&nbsp;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @dbExt = N<span style="color: #ff0000;">'.bak'</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @logExt = N<span style="color: #ff0000;">'.trn'</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @backuplocation = N<span style="color: #ff0000;">'F:<span style="color: #000099; font-weight: bold;">\S</span>QL Backup'</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DATE</span> = <span style="color: #993333; font-weight: bold; text-transform: uppercase;">CONVERT</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold; text-transform: uppercase;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>, GETDATE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">112</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @mailprofile = <span style="color: #ff0000;">'default'</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @mail_rec = <span style="color: #ff0000;">'myemailAddress@mycompany.com'</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = <span style="color: #ff0000;">'SQL Server Backup'</span> + CAST<span style="color: #66cc66;">&#40;</span>GETDATE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- cycle the log</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">EXEC</span> sp_cycle_errorlog
&nbsp;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">CREATE</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">TABLE</span> #dbInfo
<span style="color: #66cc66;">&#40;</span>
database_id int <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NOT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NULL</span>,
dbName nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NOT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NULL</span>,
recoveryModel int
<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> TOP <span style="color: #cc66cc;">1</span> @dbid = database_id <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> sys.databases <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> <span style="color: #66cc66;">&#91;</span>name<span style="color: #66cc66;">&#93;</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NOT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">LIKE</span> <span style="color: #ff0000;">'DB_2EXCLUDE%'</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AND</span> database_id &amp;gt; <span style="color: #cc66cc;">4</span>  <span style="color: #993333; font-weight: bold; text-transform: uppercase;">ORDER</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BY</span> database_id <span style="color: #993333; font-weight: bold; text-transform: uppercase;">ASC</span>;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @dbname = <span style="color: #66cc66;">&#91;</span>name<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> sys.databases <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> database_id = @dbid;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @recModel = recovery_model <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> sys.databases <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> database_id = @dbid;
&nbsp;
<span style="color: #808080; font-style: italic;">-- begin backup process</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHILE</span> @dbid &amp;gt; <span style="color: #cc66cc;">0</span>
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">BEGIN</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">INSERT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">INTO</span> #dbInfo
      <span style="color: #66cc66;">&#40;</span>database_id, dbName, recoveryModel<span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">VALUES</span>
      <span style="color: #66cc66;">&#40;</span>@dbid, @dbname, @recModel<span style="color: #66cc66;">&#41;</span>;
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">IF</span> @recModel = <span style="color: #cc66cc;">1</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BEGIN</span>
&nbsp;
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @tempFile = @backuplocation + N<span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\t</span>ransactionlog_backup_'</span>
      + @dbname + @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DATE</span> + @logExt
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'
      Backing up ['</span> + @dbname + <span style="color: #ff0000;">'] transaction log file to: '</span>  + @tempFile
      PRINT <span style="color: #ff0000;">'Backing up ['</span> + @dbname + <span style="color: #ff0000;">'] transaction log file to: '</span>  + @tempFile
&nbsp;
      CHECKPOINT
      BACKUP <span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> @dbname <span style="color: #993333; font-weight: bold; text-transform: uppercase;">TO</span> DISK = @tempFile <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WITH</span> NOFORMAT, NOINIT,
        NAME = N<span style="color: #ff0000;">'Transaction Log  Backup'</span>, SKIP, NOREWIND, NOUNLOAD,  STATS = <span style="color: #cc66cc;">10</span>
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @lasterror = @@ERROR
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">IF</span> @lasterror &amp;lt;&amp;gt; <span style="color: #cc66cc;">0</span>
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BEGIN</span>
       <span style="color: #808080; font-style: italic;">-- log the error</span>
       <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'-ERROR: Backing up database log for ['</span> +
          @dbname + <span style="color: #ff0000;">'] with error number '</span> +
          CAST<span style="color: #66cc66;">&#40;</span>@lasterror <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
       PRINT <span style="color: #ff0000;">'ERROR: Backing up database log for ['</span> + @dbname + <span style="color: #ff0000;">'] with error number '</span> +
          CAST<span style="color: #66cc66;">&#40;</span>@lasterror <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">END</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">END</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @tempFile = @backuplocation + N<span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\b</span>ackup_'</span> + @dbname + @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DATE</span> + @dbExt
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'Backing up ['</span> + @dbname + <span style="color: #ff0000;">'] database file to: '</span>  + @tempFile
   PRINT <span style="color: #ff0000;">'Backing up ['</span> + @dbname + <span style="color: #ff0000;">'] database file to: '</span>  + @tempFile
&nbsp;
   BACKUP <span style="color: #993333; font-weight: bold; text-transform: uppercase;">DATABASE</span> @dbName <span style="color: #993333; font-weight: bold; text-transform: uppercase;">TO</span>  DISK =  @tempFile <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WITH</span> NOFORMAT, NOINIT,
      NAME = N<span style="color: #ff0000;">'Full Database Backup'</span>, SKIP, NOREWIND, NOUNLOAD,  STATS = <span style="color: #cc66cc;">10</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @lasterror = @@ERROR
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">IF</span> @lasterror &amp;lt;&amp;gt; <span style="color: #cc66cc;">0</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BEGIN</span>
      <span style="color: #808080; font-style: italic;">-- log the error</span>
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'-ERROR: Backing up database: ['</span>
         + @dbname + <span style="color: #ff0000;">'] with error number '</span> +
         CAST<span style="color: #66cc66;">&#40;</span>@lasterror <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      PRINT <span style="color: #ff0000;">'ERROR: Backing up database: ['</span> + @dbname + <span style="color: #ff0000;">'] with error number '</span> +
         CAST<span style="color: #66cc66;">&#40;</span>@lasterror <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">END</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @logName nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">DECLARE</span> @param nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">-- get the transaction log name</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'
   Getting Log File Name ['</span> + @dbname + <span style="color: #ff0000;">']'</span>
   PRINT <span style="color: #ff0000;">'Getting Log File Name ['</span> + @dbname + <span style="color: #ff0000;">']'</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> = <span style="color: #ff0000;">'SELECT TOP 1 @out = name FROM '</span> + @dbname
      + <span style="color: #ff0000;">'.sys.sysfiles where FileName like '</span><span style="color: #ff0000;">'%.ldf'</span><span style="color: #ff0000;">' '</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @param = N<span style="color: #ff0000;">'@out varchar(100) OUTPUT'</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">EXEC</span> sp_executesql @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span>, @param, @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">OUT</span> = @logName OUTPUT
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'Log File Name Is '</span> + @logName
   PRINT <span style="color: #ff0000;">'Log File Name Is '</span> + @logName
&nbsp;
   <span style="color: #808080; font-style: italic;">-- shrink the transaction log file</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> = <span style="color: #ff0000;">'USE '</span> + @dbname
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> + <span style="color: #ff0000;">' DBCC SHRINKFILE (@dblogname, 0, TRUNCATEONLY);'</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span> + <span style="color: #ff0000;">' SELECT @lasterr = @@ERROR;'</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @param = <span style="color: #ff0000;">'@dblogname nvarchar(500), @lasterr int'</span>
   <span style="color: #808080; font-style: italic;">--SELECT @tempPath = @dbname+'_log'</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'
   Performing Log File Shrink ['</span> + @dbname + <span style="color: #ff0000;">']'</span>
   PRINT <span style="color: #ff0000;">'Performing Log File Shrink ['</span> + @dbname + <span style="color: #ff0000;">']'</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">EXEC</span> sp_executesql @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SQL</span>, @param, @dblogname = @logName, @lasterr = @lasterror
   <span style="color: #808080; font-style: italic;">-- error obtained in the stored procedure</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">IF</span> @lasterror &amp;lt;&amp;gt; <span style="color: #cc66cc;">0</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BEGIN</span>
      <span style="color: #808080; font-style: italic;">-- log the error</span>
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'-ERROR: Shrinking the database log file: ['</span>
         + @dbname + <span style="color: #ff0000;">'] with error number '</span> +
         CAST<span style="color: #66cc66;">&#40;</span>@lasterror <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      PRINT <span style="color: #ff0000;">'ERROR: Shrinking the database log file: ['</span>
         + @dbname + <span style="color: #ff0000;">'] with error number '</span> +
         CAST<span style="color: #66cc66;">&#40;</span>@lasterror <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">END</span>
&nbsp;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> = @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span> + <span style="color: #ff0000;">'Log File Shrink Completed'</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">-- get a new record</span>
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @dbid = <span style="color: #cc66cc;">0</span>;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> TOP <span style="color: #cc66cc;">1</span> @dbid =  database_id <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> sys.databases
      <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> <span style="color: #66cc66;">&#91;</span>name<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NOT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">LIKE</span> <span style="color: #ff0000;">'DB_2EXCLUDE%'</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AND</span> database_id &amp;gt; <span style="color: #cc66cc;">4</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AND</span>
      database_id <span style="color: #993333; font-weight: bold; text-transform: uppercase;">NOT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">DISTINCT</span> x.database_id <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> #dbInfo x<span style="color: #66cc66;">&#41;</span>;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @dbname = <span style="color: #66cc66;">&#91;</span>name<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> sys.databases <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> database_id = @dbid;
   <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> @recModel = recovery_model <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> sys.databases <span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> database_id = @dbid;
&nbsp;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">END</span>
&nbsp;
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">DROP</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">TABLE</span> #dbInfo
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">EXEC</span> msdb.dbo.sp_send_dbmail @profile_name=<span style="color: #ff0000;">'default'</span>,
   @recipients=@mail_rec,@Body_Format = <span style="color: #ff0000;">'HTML'</span>, @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">BODY</span>=@<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span>;
PRINT @<span style="color: #993333; font-weight: bold; text-transform: uppercase;">LOG</span></pre>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Configuration' rel='tag' target='_self'>Configuration</a>, <a class='technorati-link' href='http://technorati.com/tag/DBCC+Shinkfile' rel='tag' target='_self'>DBCC Shinkfile</a>, <a class='technorati-link' href='http://technorati.com/tag/logfile' rel='tag' target='_self'>logfile</a>, <a class='technorati-link' href='http://technorati.com/tag/shink' rel='tag' target='_self'>shink</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/08/24/sql-server-shrink-logs-and-custom-backup-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Operation aborted (Exception from HRESULT: 0&#215;80004004 (E_ABORT))</title>
		<link>http://www.calvinirwin.net/2009/07/26/operation-aborted-exception-from-hresult-0x80004004-e_abort/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/operation-aborted-exception-from-hresult-0x80004004-e_abort/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:53:23 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=54</guid>
		<description><![CDATA[You may get the following error sometimes when trying to do something in SharePoint: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
This is not actually a SharePoint issue but more a SQL issue...usually a result of the transaction log being full or no drive space available to it.
To view the log information use DBCC LOGINFO('[dbName]')
To fix [...]]]></description>
			<content:encoded><![CDATA[<p>You may get the following error sometimes when trying to do something in SharePoint: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))</p>
<p>This is not actually a SharePoint issue but more a SQL issue...usually a result of the transaction log being full or no drive space available to it.</p>
<p>To view the log information use <span style="font-family: courier new; color: #000099;">DBCC LOGINFO('[dbName]')</span></p>
<p>To fix the issue above, use the following code to reduce the size of the transaction log (replacing the items in square brackets with your variables - [dbName]):</p>
<div style="padding-left:15px; font-family: courier new;  color: #000099;">use [dbName]<br />
go</p>
<p>BACKUP LOG [dbName] TO DISK = N'[driveLetter]:\SQL Backup\[backupName].trn'<br />
WITH NOFORMAT, NOINIT, NAME = N'[dbName]-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10<br />
GO</p>
<p>DBCC SHRINKFILE (N'[dbLogFileName]' , 0, TRUNCATEONLY)<br />
GO</p>
<p>DBCC LOGINFO('[dbName]')</p></div>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Configuration' rel='tag' target='_self'>Configuration</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/operation-aborted-exception-from-hresult-0x80004004-e_abort/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting file size for documents in SharePoint</title>
		<link>http://www.calvinirwin.net/2009/07/26/getting-file-size-for-documents-in-sharepoint/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/getting-file-size-for-documents-in-sharepoint/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:48:38 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=49</guid>
		<description><![CDATA[Great Blog posthere on getting file size onfo from a SharePoint content db.  Here's the T-SQL
select [filename],
sum(CAST((CAST(CAST(filesize as decimal(38,2))/1024 As
decimal(38,2))/1024) AS Decimal(38,2))) AS 'Size in MB'
from (
select dirname + '/' + leafname as [filename],
size as filesize,
siteid,
webid,
ExtensionForFile
from alldocs
union
select d.dirname + '/' + d.leafname as [filename],
v.size as filesize,
d.siteid,
d.webid,
ExtensionForFile
from alldocs d
inner join alldocversions v on d.siteid = [...]]]></description>
			<content:encoded><![CDATA[<p>Great Blog post<a href="http://www.niral.net/blog/get-file-sizes-document-sharepoint-database">here</a> on getting file size onfo from a SharePoint content db.  Here's the T-SQL</p>
<div style="padding-left:15px; font-family: courier new; color: #000099;">select [filename],<br />
sum(CAST((CAST(CAST(filesize as decimal(38,2))/1024 As<br />
decimal(38,2))/1024) AS Decimal(38,2))) AS 'Size in MB'<br />
from (<br />
select dirname + '/' + leafname as [filename],<br />
size as filesize,<br />
siteid,<br />
webid,<br />
ExtensionForFile<br />
from alldocs<br />
union<br />
select d.dirname + '/' + d.leafname as [filename],<br />
v.size as filesize,<br />
d.siteid,<br />
d.webid,<br />
ExtensionForFile<br />
from alldocs d<br />
inner join alldocversions v on d.siteid = v.siteid<br />
and d.id = v.id<br />
) as results<br />
inner join webs s on s.siteid = results.siteid<br />
and s.id = results.webid<br />
where (filesize is not null<br />
and filesize &gt; 0)<br />
and ExtensionForFile not like '%aspx%' -- Not Include Certian File Types<br />
group by<br />
[Filename]<br />
order by 2 desc</div>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/getting-file-size-for-documents-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DevConnections Wrap Up &#8211; Nov 2008</title>
		<link>http://www.calvinirwin.net/2009/07/26/devconnections-wrap-up-nov-2008/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/devconnections-wrap-up-nov-2008/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:39:47 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=41</guid>
		<description><![CDATA[From November 2008:
Whew...its been a long week and its only Thursday. This years conference was much the same as last years with the exception of being held in various portions of the Mandalay Bay convention center as opposed to on one floor. This made for lots and lots and lots and lots of walking. But [...]]]></description>
			<content:encoded><![CDATA[<p>From November 2008:</p>
<p>Whew...its been a long week and its only Thursday. This years conference was much the same as last years with the exception of being held in various portions of the Mandalay Bay convention center as opposed to on one floor. This made for lots and lots and lots and lots of walking. But I'm still young (yes i am) so it makes for good excercise to walk off all the food they shovel in your mouth.</p>
<p>Most of the sessions I attended were really good with the exception of a couple. I wouldn't blame the speakers because these problems were mostly due to technical issues like the computers not working, the projectors broken or feedback in the presenters microphone sort of thing. All in all there were some great things presented this week.</p>
<p>Some of the sessions that really stuck out were:</p>
<p><a href="http://www.sqlskills.com/blogs/kimberly/">Kimberly Tripp </a>- Index Internals and Usage<br />
This was a great session that talked about thins like SQL Server Statistics, Query Optimization, Types of indexes, diminishing returns on performance, etc. Of all the session I think this one stood out the most and because it is probably the most relevant for me right now being one of the "SQL Server DBA" for my company (<a href="http://www.christiedigital.com/">Christie Digital</a>). I say it that way because its a committee based DBA <img src='http://www.calvinirwin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.west-wind.com/Weblog/">Rick Strahl </a>- Using WCF for JSON and REST Services with ASP.Net</p>
<p>Great session....last one of the conference for me so it really sticks out but essentially this covers the next gen replacement for ASMX or first gen webservices in the .NET Framework.</p>
<p><a href="http://www.johnpapa.net/">John Papa</a> - Practical Strategies with the Entity Framework</p>
<p>For me this was an introduction to the Entity Framework that was released in VS 2008 SP1. John did a great job of quickly introducing the technology and getting on to the meat and potatoes of what we were there to discuss. There was a good discussion on how to use the IDE to build the data mappings and what happens after you make changes to the backend server, which coinceidently can be any data source...not just SQL as Linq to SQL supports.</p>
<p>Things I would change...(and only because its my blog and I can say whatever I want!!!)</p>
<p>...the time between sessions was ridiculous...one hour or in some cases and hour and a half is just way too long. They could have added an extra session or two to the day. I realize they want you in the expo hall but they could have extended the day to facilitate that or leave it open all day and then some people may skip a couple of sessions here and there to go and see what the vendors are offering. this was my gripe last year and its my gripe this year. Its probably going to be the thing that keeps me from going to this in the future.</p>
<p>...provide video or podcasts of the sessions so we can take in the whole conference...even the sessions we didn't get to go to. I see there point about this being intellectual property and the speakers are consultants and this is their livelyhood but I mean if they are willing to teach this at a conference...and we pay to see it...shouldn't we be entitled to review this information after the fact? Maybe they will supply it on their site (i heard they were recording the sessions this year).</p>
<p>...ease up on the food. Damn, there was too much...I ate too much...I felt stuffed the whole time...I guess this is really my fault! Okay dont change that <img src='http://www.calvinirwin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/.net' rel='tag' target='_self'>.net</a>, <a class='technorati-link' href='http://technorati.com/tag/ASP.NET' rel='tag' target='_self'>ASP.NET</a>, <a class='technorati-link' href='http://technorati.com/tag/conference' rel='tag' target='_self'>conference</a>, <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/devconnections-wrap-up-nov-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting to a SharePoint Standalone instance DB</title>
		<link>http://www.calvinirwin.net/2009/07/26/connecting-to-a-sharepoint-standalone-instance-db/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/connecting-to-a-sharepoint-standalone-instance-db/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:30:02 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=37</guid>
		<description><![CDATA[Kudos to Scott Elliott a colleague of mine for putting this together...
Here is how I got my SQL Express to remotely respond to SQL Management Studio.
In SQL Server Configuration Manager:
Under SQL Server 2005 Network Configuration:
Protocols for

 Enable Shared Memory
 Enable Name Pipes
 Enable TCP/IP

Under SQL Server 2005 Servers

 SQL Server (ServerInstance) Properties

Log on as: Local [...]]]></description>
			<content:encoded><![CDATA[<p>Kudos to Scott Elliott a colleague of mine for putting this together...</p>
<p>Here is how I got my SQL Express to remotely respond to SQL Management Studio.</p>
<p>In SQL Server Configuration Manager:<br />
Under SQL Server 2005 Network Configuration:<br />
Protocols for</p>
<ul>
<li> Enable Shared Memory</li>
<li> Enable Name Pipes</li>
<li> Enable TCP/IP</li>
</ul>
<p>Under SQL Server 2005 Servers</p>
<ul>
<li> SQL Server (ServerInstance) Properties</li>
</ul>
<p>Log on as: Local System (have to restart)<br />
SQL Server Browser</p>
<ul>
<li> Log on as: Local System (may have to enable this service first in the Services MMC applet)</li>
</ul>
<p>And with that, you should be able to remotely connect! Hazzah!</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Security' rel='tag' target='_self'>Security</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/connecting-to-a-sharepoint-standalone-instance-db/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL 2005 Reporting Services Save Error</title>
		<link>http://www.calvinirwin.net/2009/07/26/sql-2005-reporting-services-save-error/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/sql-2005-reporting-services-save-error/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 18:29:19 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=3</guid>
		<description><![CDATA[I recently came across this problem on my reporting services server when a user attempts to save a report from a model to their my reports folder
The permissions granted to user X are insufficient for performing this operation. ---&#62; The permissions granted to user 'X' are insufficient for performing this operation.
----------------------------
Exception of type 'Microsoft.ReportingServices.RsProxy.AccessDeniedException' was [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across this problem on my reporting services server when a user attempts to save a report from a model to their my reports folder</p>
<p><em>The permissions granted to user X are insufficient for performing this operation. ---&gt; The permissions granted to user 'X' are insufficient for performing this operation.<br />
----------------------------<br />
Exception of type 'Microsoft.ReportingServices.RsProxy.AccessDeniedException' was thrown.</em></p>
<p>It seems that this problem is due to SQL server 2005 SP2 being applied because it worked fine until this was installed. The work around as far as I can tell was originally posted <a href="http://forums.asp.net/p/1173420/2001831.aspx">here</a> and I used this solution to fix the problem for myself.</p>
<p>Basically it boils down to the default save location has changed to the Models folder and the user has no rights on this folder. By granting them read only rights they are then able to navigate to their own folder to save the report.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Reporting+Services' rel='tag' target='_self'>Reporting Services</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/sql-2005-reporting-services-save-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
