<?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>mikwat code &#187; mssql</title>
	<atom:link href="http://code.mikwat.com/archives/category/mssql/feed" rel="self" type="application/rss+xml" />
	<link>http://code.mikwat.com</link>
	<description>A coder's daily explorations through PHP, Java, CSS, JavaScript, Linux, OS X, Apache, Tomcat, and everything else.</description>
	<lastBuildDate>Wed, 20 Feb 2008 22:14:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MSSQL Transaction Log Full</title>
		<link>http://code.mikwat.com/archives/14</link>
		<comments>http://code.mikwat.com/archives/14#comments</comments>
		<pubDate>Mon, 09 Apr 2007 01:13:34 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[mssql]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/archives/14</guid>
		<description><![CDATA[Problem: Occasionally I get the following JDBC error from MSSQL:
The log file for database 'db_example' is full. Back up the transaction log for the database to free up some log space.
Solution:
BACKUP LOG db_example WITH TRUNCATE_ONLY
DBCC SHRINKFILE(db_example_log, 2)
If &#8216;db_example_log&#8217; is not the logical name of the logfile, the 2nd command will fail.  The correct logical [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> Occasionally I get the following JDBC error from <a href="/archives/category/mssql">MSSQL</a>:</p>
<p><code>The log file for database 'db_example' is full. Back up the transaction log for the database to free up some log space.</code></p>
<p><strong>Solution:</strong></p>
<p><code>BACKUP LOG db_example WITH TRUNCATE_ONLY<br />
DBCC SHRINKFILE(db_example_log, 2)</code></p>
<p>If &#8216;db_example_log&#8217; is not the logical name of the logfile, the 2nd command will fail.  The correct logical name can be found by running the following statements:</p>
<p><code> USE db_example;<br />
SELECT * FROM sysfiles;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/14/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSSQL Fix Owner</title>
		<link>http://code.mikwat.com/archives/6</link>
		<comments>http://code.mikwat.com/archives/6#comments</comments>
		<pubDate>Tue, 31 Oct 2006 17:39:38 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[mssql]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/?p=6</guid>
		<description><![CDATA[ For whatever reason, it&#8217;s occasionally necessary to change the owner of tables in MSSQL.  In this example, we are changing the owner from &#8220;oldowner&#8221; to &#8220;dbo&#8221;:
declare tabcurs cursor
for
   select 'oldowner.' + name
   from sysobjects
   where xtype = 'u' OR xtype = 'v'

open tabcurs
declare @tname nvarchar(517)
fetch next from tabcurs into [...]]]></description>
			<content:encoded><![CDATA[<p> For whatever reason, it&#8217;s occasionally necessary to change the owner of tables in MSSQL.  In this example, we are changing the owner from &#8220;oldowner&#8221; to &#8220;dbo&#8221;:</p>
<pre>declare tabcurs cursor
for
   select 'oldowner.' + name
   from sysobjects
   where xtype = 'u' OR xtype = 'v'

open tabcurs
declare @tname nvarchar(517)
fetch next from tabcurs into @tname
while @@fetch_status = 0
begin
   exec sp_changeobjectowner @tname, 'dbo'
   fetch next from tabcurs into @tname
end
close tabcurs
deallocate tabcurs</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
