<?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>Tue, 08 Mar 2011 19:23:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MSSQL Bulk Insert from CSV file</title>
		<link>http://code.mikwat.com/archives/15</link>
		<comments>http://code.mikwat.com/archives/15#comments</comments>
		<pubDate>Fri, 18 Feb 2011 00:10:38 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[mssql]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/?p=15</guid>
		<description><![CDATA[http://www.thescripts.com/forum/thread158756.html BULK INSERT Test FROM 'X:\temp\Test.CSV' WITH ( DATAFILETYPE = 'char', FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) Could not bulk insert because file &#8216;X:\temp\Test.CSV&#8217; could not be opened. Operating system error code 3(The system cannot find the path specified.). http://support.microsoft.com/kb/316371 objBL.transaction = "FALSE"]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thescripts.com/forum/thread158756.html" onclick="pageTracker._trackPageview('/outgoing/www.thescripts.com/forum/thread158756.html?referer=');">http://www.thescripts.com/forum/thread158756.html</a></p>
<pre>
BULK INSERT Test FROM 'X:\temp\Test.CSV'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
</pre>
<p>Could not bulk insert because file &#8216;X:\temp\Test.CSV&#8217; could not be opened. Operating system error code 3(The system cannot find the path specified.).</p>
<p><a href="http://support.microsoft.com/kb/316371" onclick="pageTracker._trackPageview('/outgoing/support.microsoft.com/kb/316371?referer=');">http://support.microsoft.com/kb/316371</a></p>
<pre class="code">objBL.transaction = "FALSE"</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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 [...]]]></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 @tname [...]]]></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>

