<?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>SharePoint Geek &#187; sql</title>
	<atom:link href="http://sharepoint-geek.com/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://sharepoint-geek.com</link>
	<description>SharePoint Tips &#38; Tricks</description>
	<lastBuildDate>Thu, 29 Jul 2010 19:19:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SQL Server Versions List</title>
		<link>http://sharepoint-geek.com/2010/07/19/sql-server-versions-list/</link>
		<comments>http://sharepoint-geek.com/2010/07/19/sql-server-versions-list/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 18:25:41 +0000</pubDate>
		<dc:creator>stewart</dc:creator>
				<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[sql server 2008]]></category>

		<guid isPermaLink="false">http://sharepoint-geek.com/2010/07/19/sql-server-versions-list/</guid>
		<description><![CDATA[Bill Graziano at SQLTeam.com has a listing of all the SQL Server versions that come in very handy: http://www.sqlteam.com/article/sql-server-versions Tags: sql, sql server, sql server 2008 Related posts No related posts.]]></description>
			<content:encoded><![CDATA[<p>Bill Graziano at <a href="http://www.sqlteam.com">SQLTeam.com</a> has a listing of all the <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> Server versions that come in very handy:    </p>
<p><a title="http://www.sqlteam.com/article/sql-server-versions" href="http://www.sqlteam.com/article/sql-server-versions">http://www.sqlteam.com/article/sql-server-versions</a></p>

	Tags: <a href="http://sharepoint-geek.com/category/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/category/sql-server/" title="sql server" rel="tag">sql server</a>, <a href="http://sharepoint-geek.com/category/sql-server-2008/" title="sql server 2008" rel="tag">sql server 2008</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://sharepoint-geek.com/2010/07/19/sql-server-versions-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shrink All Log Files Within A MS SQL 2008 Instance</title>
		<link>http://sharepoint-geek.com/2010/06/18/shrink-all-log-files-within-a-ms-sql-2008-instance/</link>
		<comments>http://sharepoint-geek.com/2010/06/18/shrink-all-log-files-within-a-ms-sql-2008-instance/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 17:57:49 +0000</pubDate>
		<dc:creator>stewart</dc:creator>
				<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[sql server 2008]]></category>
		<category><![CDATA[transaction logs]]></category>

		<guid isPermaLink="false">http://sharepoint-geek.com/2010/06/18/shrink-all-log-files-within-a-ms-sql-2008-instance/</guid>
		<description><![CDATA[This is an update to a previous post (Shrink All Log Files Within A MS SQL Instance) that has been edited to work in SQL Server 2008. declare @ssql nvarchar(4000) set @ssql= ' if ''?'' not in (''tempdb'',''master'',''model'',''msdb'') begin use [?] declare @tsql nvarchar(4000) set @tsql = '''' declare @recmodel nvarchar(10) declare @iLogFile int declare [...]]]></description>
			<content:encoded><![CDATA[<p>This is an update to a previous post (<a href="http://sharepoint-geek.com/2010/04/07/shrink-all-log-files-within-a-ms-sql-instance/">Shrink All Log Files Within A MS SQL Instance</a>) that has been edited to work in <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> Server 2008.</p>
<div style="border-bottom: #484848 1px solid; border-left: #484848 1px solid; width: 550px; height: 400px; overflow: scroll; border-top: #484848 1px solid; border-right: #484848 1px solid">
<pre class="csharpcode"><span class="kwrd">declare</span> @ssql nvarchar(4000)
<span class="kwrd">set</span> @ssql= <span class="str">'
    if '</span><span class="str">'?'</span><span class="str">' not in ('</span><span class="str">'tempdb'</span><span class="str">','</span><span class="str">'master'</span><span class="str">','</span><span class="str">'model'</span><span class="str">','</span><span class="str">'msdb'</span><span class="str">')
        begin
            use [?]
            declare @tsql nvarchar(4000) set @tsql = '</span><span class="str">''</span><span class="str">'
            declare @recmodel nvarchar(10)
            declare @iLogFile int
            declare LogFiles cursor for
            select fileid from sysfiles where  status &amp; 0x40 = 0x40
            open LogFiles
            fetch next from LogFiles into @iLogFile
            while @@fetch_status = 0
                begin
                    select @recmodel = (SELECT recovery_model_desc FROM sys.databases WHERE name = '</span><span class="str">'?'</span><span class="str">' )
                    if @recmodel = '</span><span class="str">'FULL'</span><span class="str">'
                        begin
                            set @tsql = @tsql + '</span><span class="str">'use [?] '</span><span class="str">'
                            set @tsql = @tsql + '</span><span class="str">'ALTER DATABASE [?] SET RECOVERY SIMPLE '</span><span class="str">'
                            set @tsql = @tsql + '</span><span class="str">'DBCC SHRINKFILE('</span><span class="str">'+cast(@iLogFile as varchar(5))+'</span><span class="str">', 1) '</span><span class="str">'
                            set @tsql = @tsql + '</span><span class="str">'ALTER DATABASE [?] SET RECOVERY FULL '</span><span class="str">'
                        end
                    else
                        set @tsql = @tsql + '</span><span class="str">'DBCC SHRINKFILE('</span><span class="str">'+cast(@iLogFile as varchar(5))+'</span><span class="str">', 1) '</span><span class="str">'
                    fetch next from LogFiles into @iLogFile
            end
            --set @tsql = @tsql + '</span><span class="str">' BACKUP LOG [?] WITH TRUNCATE_ONLY '</span><span class="str">' + @tsql
            --print @tsql
            exec(@tsql)
            close LogFiles
            DEALLOCATE LogFiles
        end'</span>
<span class="kwrd">exec</span> sp_msforeachdb @ssql</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</div>

	Tags: <a href="http://sharepoint-geek.com/category/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/category/sql-server/" title="sql server" rel="tag">sql server</a>, <a href="http://sharepoint-geek.com/category/sql-server-2008/" title="sql server 2008" rel="tag">sql server 2008</a>, <a href="http://sharepoint-geek.com/category/transaction-logs/" title="transaction logs" rel="tag">transaction logs</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://sharepoint-geek.com/2010/06/18/shrink-all-log-files-within-a-ms-sql-2008-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shrink All Log Files Within A MS SQL Instance</title>
		<link>http://sharepoint-geek.com/2010/04/07/shrink-all-log-files-within-a-ms-sql-instance/</link>
		<comments>http://sharepoint-geek.com/2010/04/07/shrink-all-log-files-within-a-ms-sql-instance/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 11:58:09 +0000</pubDate>
		<dc:creator>stewart</dc:creator>
				<category><![CDATA[logs]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://sharepoint-geek.com/2010/04/07/shrink-all-log-files-within-a-ms-sql-instance/</guid>
		<description><![CDATA[This little SQL script is used to to shrink all the log files in a Microsoft SQL server instance.&#160; It uses the following function to get the job done: DBCC SHRINKFILE. declare @ssql nvarchar(4000) set @ssql= ' if ''?'' not in (''tempdb'',''master'',''model'',''msdb'') begin use [?] declare @tsql nvarchar(4000) set @tsql = '''' declare @iLogFile int [...]]]></description>
			<content:encoded><![CDATA[<p>This little <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> script is used to to shrink all the log files in a Microsoft <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> server instance.&#160; It uses the following function to get the job done: DBCC SHRINKFILE.</p>
<div class="csharpcode">
<pre class="alt"><span class="kwrd">declare</span> @ssql nvarchar(4000)</pre>
<pre><span class="kwrd">set</span> @ssql= <span class="str">'</pre>
<pre class="alt">        if '</span><span class="str">'?'</span><span class="str">' not in ('</span><span class="str">'tempdb'</span><span class="str">','</span><span class="str">'master'</span><span class="str">','</span><span class="str">'model'</span><span class="str">','</span><span class="str">'msdb'</span><span class="str">') begin</pre>
<pre>        use [?]</pre>
<pre class="alt">        declare @tsql nvarchar(4000) set @tsql = '</span><span class="str">''</span><span class="str">'</pre>
<pre>        declare @iLogFile int</pre>
<pre class="alt">        declare LogFiles cursor for</pre>
<pre>        select fileid from sysfiles where  status &amp; 0x40 = 0x40</pre>
<pre class="alt">        open LogFiles</pre>
<pre>        fetch next from LogFiles into @iLogFile</pre>
<pre class="alt">        while @@fetch_status = 0</pre>
<pre>        begin</pre>
<pre class="alt">          set @tsql = @tsql + '</span><span class="str">'DBCC SHRINKFILE('</span><span class="str">'+cast(@iLogFile as varchar(5))+'</span><span class="str">', 1) '</span><span class="str">'</pre>
<pre>          fetch next from LogFiles into @iLogFile</pre>
<pre class="alt">        end</pre>
<pre>        set @tsql = @tsql + '</span><span class="str">' BACKUP LOG [?] WITH TRUNCATE_ONLY '</span><span class="str">' + @tsql</pre>
<pre class="alt">        --print @tsql</pre>
<pre>        exec(@tsql)</pre>
<pre class="alt">        close LogFiles</pre>
<pre>        DEALLOCATE LogFiles</pre>
<pre class="alt">        end'</span></pre>
<pre>&#160;</pre>
<pre class="alt">

<span class="kwrd">exec</span> sp_msforeachdb @ssql
</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
overflow:scroll;
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>via <a href="http://codesnippets.joyent.com/posts/show/665">CodeSnippets</a></p>

	Tags: <a href="http://sharepoint-geek.com/category/logs/" title="logs" rel="tag">logs</a>, <a href="http://sharepoint-geek.com/category/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/category/sql-server/" title="sql server" rel="tag">sql server</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://sharepoint-geek.com/2010/04/07/shrink-all-log-files-within-a-ms-sql-instance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL To Search Every Column Of Every Table</title>
		<link>http://sharepoint-geek.com/2010/04/02/sql-to-search-every-column-of-every-table/</link>
		<comments>http://sharepoint-geek.com/2010/04/02/sql-to-search-every-column-of-every-table/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 15:25:13 +0000</pubDate>
		<dc:creator>stewart</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint list]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://sharepoint-geek.com/2010/04/02/sql-to-search-every-column-of-every-table/</guid>
		<description><![CDATA[I was trying to export a site that had been moved from a MOSS farm to a WSS farm and was getting an error that a list did not exist.&#160; Well, I’ve fought with this particular web application for quite a while and was sick of getting stupid little errors because of the move from [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to export a site that had been moved from a MOSS farm to a WSS farm and was getting an error that a list did not exist.&#160; Well, I’ve fought with this particular web application for quite a while and was sick of getting stupid little errors because of the move from MOSS to WSS.&#160; So, I was able to find a <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> Stored Procedure that I could use to delete all references to the “orphaned” list.</p>
<p>I found this Stored Procedure on <a href="http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm">Vyas Kondreddi’s website</a>.</p>
<div class="csharpcode" id="code">
<pre class="alt"><span class="kwrd">CREATE</span> <span class="kwrd">PROC</span> SearchAllTables</pre>
<pre>(</pre>
<pre class="alt">    @SearchStr nvarchar(100)</pre>
<pre>)</pre>
<pre class="alt"><span class="kwrd">AS</span></pre>
<pre><span class="kwrd">BEGIN</span></pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="rem">-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.</span></pre>
<pre class="alt">    <span class="rem">-- Purpose: To search all columns of all tables for a given search string</span></pre>
<pre>    <span class="rem">-- Written by: Narayana Vyas Kondreddi</span></pre>
<pre class="alt">    <span class="rem">-- Site: http://vyaskn.tripod.com</span></pre>
<pre>    <span class="rem">-- Tested on: <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> Server 7.0 and <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> Server 2000</span></pre>
<pre class="alt">    <span class="rem">-- Date modified: 28th July 2002 22:50 GMT</span></pre>
<pre>&#160;</pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">CREATE</span> <span class="kwrd">TABLE</span> #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))</pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">SET</span> NOCOUNT <span class="kwrd">ON</span></pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">DECLARE</span> @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)</pre>
<pre class="alt">    <span class="kwrd">SET</span>  @TableName = <span class="str">''</span></pre>
<pre>    <span class="kwrd">SET</span> @SearchStr2 = QUOTENAME(<span class="str">'%'</span> + @SearchStr + <span class="str">'%'</span>,<span class="str">''</span><span class="str">''</span>)</pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">WHILE</span> @TableName <span class="kwrd">IS</span> <span class="kwrd">NOT</span> <span class="kwrd">NULL</span></pre>
<pre class="alt">    <span class="kwrd">BEGIN</span></pre>
<pre>        <span class="kwrd">SET</span> @ColumnName = <span class="str">''</span></pre>
<pre class="alt">        <span class="kwrd">SET</span> @TableName = </pre>
<pre>        (</pre>
<pre class="alt">            <span class="kwrd">SELECT</span> <span class="kwrd">MIN</span>(QUOTENAME(TABLE_SCHEMA) + <span class="str">'.'</span> + QUOTENAME(TABLE_NAME))</pre>
<pre>            <span class="kwrd">FROM</span>     INFORMATION_SCHEMA.TABLES</pre>
<pre class="alt">            <span class="kwrd">WHERE</span>         TABLE_TYPE = <span class="str">'BASE TABLE'</span></pre>
<pre>                <span class="kwrd">AND</span>    QUOTENAME(TABLE_SCHEMA) + <span class="str">'.'</span> + QUOTENAME(TABLE_NAME) &gt; @TableName</pre>
<pre class="alt">                <span class="kwrd">AND</span>    OBJECTPROPERTY(</pre>
<pre>                        OBJECT_ID(</pre>
<pre class="alt">                            QUOTENAME(TABLE_SCHEMA) + <span class="str">'.'</span> + QUOTENAME(TABLE_NAME)</pre>
<pre>                             ), <span class="str">'IsMSShipped'</span></pre>
<pre class="alt">                               ) = 0</pre>
<pre>        )</pre>
<pre class="alt">&#160;</pre>
<pre>        <span class="kwrd">WHILE</span> (@TableName <span class="kwrd">IS</span> <span class="kwrd">NOT</span> <span class="kwrd">NULL</span>) <span class="kwrd">AND</span> (@ColumnName <span class="kwrd">IS</span> <span class="kwrd">NOT</span> <span class="kwrd">NULL</span>)</pre>
<pre class="alt">        <span class="kwrd">BEGIN</span></pre>
<pre>            <span class="kwrd">SET</span> @ColumnName =</pre>
<pre class="alt">            (</pre>
<pre>                <span class="kwrd">SELECT</span> <span class="kwrd">MIN</span>(QUOTENAME(COLUMN_NAME))</pre>
<pre class="alt">                <span class="kwrd">FROM</span>     INFORMATION_SCHEMA.COLUMNS</pre>
<pre>                <span class="kwrd">WHERE</span>         TABLE_SCHEMA    = PARSENAME(@TableName, 2)</pre>
<pre class="alt">                    <span class="kwrd">AND</span>    TABLE_NAME    = PARSENAME(@TableName, 1)</pre>
<pre>                    <span class="kwrd">AND</span>    DATA_TYPE <span class="kwrd">IN</span> (<span class="str">'char'</span>, <span class="str">'varchar'</span>, <span class="str">'nchar'</span>, <span class="str">'nvarchar'</span>)</pre>
<pre class="alt">                    <span class="kwrd">AND</span>    QUOTENAME(COLUMN_NAME) &gt; @ColumnName</pre>
<pre>            )</pre>
<pre class="alt">    </pre>
<pre>            <span class="kwrd">IF</span> @ColumnName <span class="kwrd">IS</span> <span class="kwrd">NOT</span> <span class="kwrd">NULL</span></pre>
<pre class="alt">            <span class="kwrd">BEGIN</span></pre>
<pre>                INSERT <span class="kwrd">INTO</span> #Results</pre>
<pre class="alt">                <span class="kwrd">EXEC</span></pre>
<pre>                (</pre>
<pre class="alt">                    <span class="str">'SELECT '</span><span class="str">''</span> + @TableName + <span class="str">'.'</span> + @ColumnName + <span class="str">''</span><span class="str">', LEFT('</span> + @ColumnName + <span class="str">', 3630) </pre>
<pre>                    FROM '</span> + @TableName + <span class="str">' (NOLOCK) '</span> +</pre>
<pre class="alt">                    <span class="str">' WHERE '</span> + @ColumnName + <span class="str">' LIKE '</span> + @SearchStr2</pre>
<pre>                )</pre>
<pre class="alt">            <span class="kwrd">END</span></pre>
<pre>        <span class="kwrd">END</span>    </pre>
<pre class="alt">    <span class="kwrd">END</span></pre>
<pre>&#160;</pre>
<pre class="alt">    <span class="kwrd">SELECT</span> ColumnName, ColumnValue <span class="kwrd">FROM</span> #Results</pre>
<pre><span class="kwrd">END</span></pre>
</div>
<style type="text/css">
<p>#code {width:500px;overflow:scroll;}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

	Tags: <a href="http://sharepoint-geek.com/category/moss/" title="MOSS" rel="tag">MOSS</a>, <a href="http://sharepoint-geek.com/category/sharepoint-list/" title="sharepoint list" rel="tag">sharepoint list</a>, <a href="http://sharepoint-geek.com/category/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/category/wss/" title="wss" rel="tag">wss</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://sharepoint-geek.com/2010/04/02/sql-to-search-every-column-of-every-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shrink SQL Transaction Logs</title>
		<link>http://sharepoint-geek.com/2009/12/28/shrink-sql-transaction-logs/</link>
		<comments>http://sharepoint-geek.com/2009/12/28/shrink-sql-transaction-logs/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 23:04:00 +0000</pubDate>
		<dc:creator>stewart</dc:creator>
				<category><![CDATA[logs]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[transaction logs]]></category>

		<guid isPermaLink="false">http://sharepoint-geek.com/2009/12/28/shrink-sql-transaction-logs/</guid>
		<description><![CDATA[Here is the t-sql statement used to shrink the SQL transaction logs: Use &#60;DatabaseName&#62; Go Backup Log &#60;DatabaseName&#62; With Truncate_Only DBCC SHRINKFILE(&#60;TransactionLogName&#62;, 1) Go .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the t-<a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">sql</a> statement used to shrink the <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> transaction logs:</p>
<pre class="csharpcode"><span class="kwrd">Use</span> &lt;DatabaseName&gt;
<span class="kwrd">Go</span>
<span class="kwrd">Backup</span> Log &lt;DatabaseName&gt; <span class="kwrd">With</span> Truncate_Only
<span class="kwrd">DBCC</span> SHRINKFILE(&lt;TransactionLogName&gt;, 1)
<span class="kwrd">Go</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

	Tags: <a href="http://sharepoint-geek.com/category/logs/" title="logs" rel="tag">logs</a>, <a href="http://sharepoint-geek.com/category/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/tag/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/category/sql-server/" title="sql server" rel="tag">sql server</a>, <a href="http://sharepoint-geek.com/category/transaction-logs/" title="transaction logs" rel="tag">transaction logs</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://sharepoint-geek.com/2009/11/05/sharepoint-alerts-not-working/" title="SharePoint Alerts Not Working (November 5, 2009)">SharePoint Alerts Not Working</a> (5)</li>
	<li><a href="http://sharepoint-geek.com/2009/11/18/backup-all-sql-server-databases/" title="Backup All SQL Server Databases (November 18, 2009)">Backup All SQL Server Databases</a> (0)</li>
	<li><a href="http://sharepoint-geek.com/2010/01/07/a-potentially-dangerous-request-form-value/" title="A potentially dangerous Request.Form value (January 7, 2010)">A potentially dangerous Request.Form value</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://sharepoint-geek.com/2009/12/28/shrink-sql-transaction-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup All SQL Server Databases</title>
		<link>http://sharepoint-geek.com/2009/11/18/backup-all-sql-server-databases/</link>
		<comments>http://sharepoint-geek.com/2009/11/18/backup-all-sql-server-databases/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 18:20:00 +0000</pubDate>
		<dc:creator>stewart</dc:creator>
				<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://sharepoint-geek.com/2009/11/18/backup-all-sql-server-databases/</guid>
		<description><![CDATA[I came across this script to backup all SQL Server databases: Code Snippet DECLARE @name VARCHAR(50) -- database name DECLARE @path VARCHAR(256) -- path for backup files DECLARE @fileName VARCHAR(256) -- filename for backup DECLARE @fileDate VARCHAR(20) -- used for file name SET @path = 'E:\Backups\Dynamics' SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) DECLARE db_cursor CURSOR FOR SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this script to backup all <a href="http://sharepoint-geek.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> Server databases:</p>
<p>
<div style="padding-right: 0px; padding-left: 0px; background: #808080; padding-bottom: 0px; margin-left: 4px; margin-right: 4px; padding-top: 0px">
<div style="border-right: #2e595c 1px solid; border-top: #2e595c 1px solid; background: #fff; left: -2px; border-left: #2e595c 1px solid; color: black; border-bottom: #2e595c 1px solid; position: relative; top: -2px">
<div style="border-right: blue 1px solid; border-top: blue 1px solid; background: #3f73b6; border-left: blue 1px solid; width: 100%; color: white; border-bottom: blue 1px solid"><span style="width: 100%">Code Snippet</span></div>
<pre></span><span style="color: #000000">DECLARE</span><span style="color: #000000"> @name </span><span style="color: #000000">VARCHAR</span><span style="color: #00ff00">(</span><span style="color: #000000">50</span><span style="color: #00ff00">)</span><span style="color: #000000"> </span><span style="color: #ff00ff">-- database name
</span><span style="color: #000000">DECLARE</span><span style="color: #000000"> @path </span><span style="color: #000000">VARCHAR</span><span style="color: #00ff00">(</span><span style="color: #000000">256</span><span style="color: #00ff00">)</span><span style="color: #000000"> </span><span style="color: #ff00ff">-- path for backup files
</span><span style="color: #000000">DECLARE</span><span style="color: #000000"> @fileName </span><span style="color: #000000">VARCHAR</span><span style="color: #00ff00">(</span><span style="color: #000000">256</span><span style="color: #00ff00">)</span><span style="color: #000000"> </span><span style="color: #ff00ff">-- filename for backup
</span><span style="color: #000000">DECLARE</span><span style="color: #000000"> @fileDate </span><span style="color: #000000">VARCHAR</span><span style="color: #00ff00">(</span><span style="color: #000000">20</span><span style="color: #00ff00">)</span><span style="color: #000000"> </span><span style="color: #ff00ff">-- used for file name

</span><span style="color: #000000">SET</span><span style="color: #000000"> @path </span><span style="color: #00ff00">=</span><span style="color: #000000"> </span><span style="color: #ff0000">'E:\Backups\Dynamics'</span><span style="color: #000000"> 

</span><span style="color: #000000">SELECT</span><span style="color: #000000"> @fileDate </span><span style="color: #00ff00">=</span><span style="color: #000000"> </span><span style="color: #ffff00">CONVERT</span><span style="color: #00ff00">(</span><span style="color: #000000">VARCHAR</span><span style="color: #00ff00">(</span><span style="color: #000000">20</span><span style="color: #00ff00">),</span><span style="color: #ffff00">GETDATE</span><span style="color: #00ff00">(),</span><span style="color: #000000">112</span><span style="color: #00ff00">)

</span><span style="color: #000000">DECLARE</span><span style="color: #000000"> db_cursor </span><span style="color: #000000">CURSOR</span><span style="color: #000000"> </span><span style="color: #000000">FOR</span><span style="color: #000000">
</span><span style="color: #000000">SELECT</span><span style="color: #000000"> </span><span style="color: #000000">name</span><span style="color: #000000">
</span><span style="color: #000000">FROM</span><span style="color: #000000"> master</span><span style="color: #00ff00">.</span><span style="color: #000000">dbo</span><span style="color: #00ff00">.</span><span style="color: #000000">sysdatabases
</span><span style="color: #000000">WHERE</span><span style="color: #000000"> </span><span style="color: #000000">name</span><span style="color: #000000"> </span><span style="color: #00ff00">NOT</span><span style="color: #000000"> </span><span style="color: #00ff00">IN</span><span style="color: #000000"> </span><span style="color: #00ff00">(</span><span style="color: #ff0000">'master'</span><span style="color: #00ff00">,</span><span style="color: #ff0000">'model'</span><span style="color: #00ff00">,</span><span style="color: #ff0000">'msdb'</span><span style="color: #00ff00">,</span><span style="color: #ff0000">'tempdb'</span><span style="color: #00ff00">)</span><span style="color: #000000"> 

</span><span style="color: #000000">OPEN</span><span style="color: #000000"> db_cursor
</span><span style="color: #000000">FETCH</span><span style="color: #000000"> </span><span style="color: #000000">NEXT</span><span style="color: #000000"> </span><span style="color: #000000">FROM</span><span style="color: #000000"> db_cursor </span><span style="color: #000000">INTO</span><span style="color: #000000"> @name  

</span><span style="color: #000000">WHILE</span><span style="color: #000000"> </span><span style="color: #ffff00">@@FETCH_STATUS</span><span style="color: #000000"> </span><span style="color: #00ff00">=</span><span style="color: #000000"> 0
</span><span style="color: #000000">BEGIN</span><span style="color: #000000">
       </span><span style="color: #000000">SET</span><span style="color: #000000"> @fileName </span><span style="color: #00ff00">=</span><span style="color: #000000"> @path </span><span style="color: #00ff00">+</span><span style="color: #000000"> @name </span><span style="color: #00ff00">+</span><span style="color: #000000"> </span><span style="color: #ff0000">'_'</span><span style="color: #000000"> </span><span style="color: #00ff00">+</span><span style="color: #000000"> @fileDate </span><span style="color: #00ff00">+</span><span style="color: #000000"> </span><span style="color: #ff0000">'.BAK'</span><span style="color: #000000">
       </span><span style="color: #000000">BACKUP</span><span style="color: #000000"> </span><span style="color: #000000">DATABASE</span><span style="color: #000000"> @name </span><span style="color: #000000">TO</span><span style="color: #000000"> </span><span style="color: #000000">DISK</span><span style="color: #000000"> </span><span style="color: #00ff00">=</span><span style="color: #000000"> @fileName 

       </span><span style="color: #000000">FETCH</span><span style="color: #000000"> </span><span style="color: #000000">NEXT</span><span style="color: #000000"> </span><span style="color: #000000">FROM</span><span style="color: #000000"> db_cursor </span><span style="color: #000000">INTO</span><span style="color: #000000"> @name
</span><span style="color: #000000">END</span><span style="color: #000000">  

</span><span style="color: #000000">CLOSE</span><span style="color: #000000"> db_cursor
</span><span style="color: #000000">DEALLOCATE</span><span style="color: #000000"> db_cursor
</PRE< DIV></pre>
</div>
<p>&nbsp;</p>
<p></span></div>

	Tags: <a href="http://sharepoint-geek.com/category/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/tag/sql/" title="sql" rel="tag">sql</a>, <a href="http://sharepoint-geek.com/category/sql-server/" title="sql server" rel="tag">sql server</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://sharepoint-geek.com/2009/12/28/shrink-sql-transaction-logs/" title="Shrink SQL Transaction Logs (December 28, 2009)">Shrink SQL Transaction Logs</a> (0)</li>
	<li><a href="http://sharepoint-geek.com/2009/11/05/sharepoint-alerts-not-working/" title="SharePoint Alerts Not Working (November 5, 2009)">SharePoint Alerts Not Working</a> (5)</li>
	<li><a href="http://sharepoint-geek.com/2010/01/07/a-potentially-dangerous-request-form-value/" title="A potentially dangerous Request.Form value (January 7, 2010)">A potentially dangerous Request.Form value</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://sharepoint-geek.com/2009/11/18/backup-all-sql-server-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
