<?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>TechBlog &#187; Commands</title>
	<atom:link href="http://techblog.byllemos.com/category/sql/commands/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.byllemos.com</link>
	<description>Accelerating into the Future with Wisdom about Technology! Ingrid Byllemos</description>
	<lastBuildDate>Tue, 05 Jan 2010 00:04:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to transfer user logins between to SQL Servers</title>
		<link>http://techblog.byllemos.com/2009/06/how-to-transfer-user-logins-between-to-sql-servers/</link>
		<comments>http://techblog.byllemos.com/2009/06/how-to-transfer-user-logins-between-to-sql-servers/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 13:24:23 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Logins]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=307</guid>
		<description><![CDATA[<p>Hi !</p>
<p>If you are installing a new SQL Server and would like to transfer the logins from an old SQL Server, without doing a SQL restore, then you can do it with a script.</p>
<p>Take a look on this&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Hi !</p>
<p>If you are installing a new SQL Server and would like to transfer the logins from an old SQL Server, without doing a SQL restore, then you can do it with a script.</p>
<p>Take a look on this article <a href="http://support.microsoft.com/kb/246133/">How to transfer logins and passwords between instances of SQL Server</a>; here Microsoft describes how to do it.<span id="more-307"></span></p>
<p>Basically it is a 2 part step. First you export the current user informations from the old server and then afterwards you run a create script on the new server. The detailed scripts can be found in the article from Microsoft <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2009/06/how-to-transfer-user-logins-between-to-sql-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DBREINDEX and INDEXDEFRAG example</title>
		<link>http://techblog.byllemos.com/2006/04/dbreindex-and-indexdefrag-example/</link>
		<comments>http://techblog.byllemos.com/2006/04/dbreindex-and-indexdefrag-example/#comments</comments>
		<pubDate>Tue, 04 Apr 2006 19:37:47 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=37</guid>
		<description><![CDATA[<p>If you have to optimize a lot of tables and indexes. You could create a SQL script, which then could be scheduled.</p>
<p><span id="more-37"></span></p>
<p>Example a script that is starting with doing a reindex and the continues with indexdefrag.</p>
<p><pre class="devcodeblock" title=""><div class="devcodeoverflow">
CREATE</div></pre>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>If you have to optimize a lot of tables and indexes. You could create a SQL script, which then could be scheduled.</p>
<p><span id="more-37"></span></p>
<p>Example a script that is starting with doing a reindex and the continues with indexdefrag.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow">
CREATE   proc DB_Maint AS
&nbsp;
set nocount on
&nbsp;
DBCC DBReIndex <span class="br0">&#40;</span><span class="br0">&#91;</span>$Post Code<span class="br0">&#93;</span>, <span class="br0">&#91;</span>$<span style="">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
DBCC DBReIndex <span class="br0">&#40;</span><span class="br0">&#91;</span>$Customer<span class="br0">&#93;</span>, <span class="br0">&#91;</span>$<span style="">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
commit
&nbsp;
RAISERROR <span class="br0">&#40;</span>'Reindex done', <span style="">16</span>, <span style="">1</span> <span class="br0">&#41;</span> with log, nowait
&nbsp;
DBCC IndexDefrag <span class="br0">&#40;</span><span style="">0</span>, <span class="br0">&#91;</span>$Customer<span class="br0">&#93;</span>, <span class="br0">&#91;</span>$Customer$<span style="">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
DBCC IndexDefrag <span class="br0">&#40;</span><span style="">0</span>, <span class="br0">&#91;</span>$Customer<span class="br0">&#93;</span>,  <span class="br0">&#91;</span>$<span style="">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
DBCC IndexDefrag <span class="br0">&#40;</span><span style="">0</span>, <span class="br0">&#91;</span>$Customer<span class="br0">&#93;</span>,  <span class="br0">&#91;</span>$<span style="">2</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
&nbsp;
commit
RAISERROR <span class="br0">&#40;</span>'IndexDefrag Customer done', <span style="">16</span>, <span style="">1</span> <span class="br0">&#41;</span> with log, nowait
&nbsp;
commit
RAISERROR <span class="br0">&#40;</span>'IndexDefrag Basis done', <span style="">16</span>, <span style="">1</span> <span class="br0">&#41;</span> with log, nowait
&nbsp;
GO</div></pre><!--END_DEVFMTCODE--><br />
</p>
<p>With the use of the RAISERROR command I am getting some log entries, and thereby I can always see how far the script is in its execution.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2006/04/dbreindex-and-indexdefrag-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some usefull SQL Commands</title>
		<link>http://techblog.byllemos.com/2006/04/some-usefull-sql-commands/</link>
		<comments>http://techblog.byllemos.com/2006/04/some-usefull-sql-commands/#comments</comments>
		<pubDate>Sun, 02 Apr 2006 22:23:52 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=36</guid>
		<description><![CDATA[<p>If you are a SQL Server administrator or just working with it, these commands would be use full for you.</p>
<p><strong>ALTER INDEX</strong></p>
<p>Modifies an existing table or view index (relational or XML) by disabling, rebuilding, or reorganizing the index; or&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>If you are a SQL Server administrator or just working with it, these commands would be use full for you.</p>
<p><strong>ALTER INDEX</strong></p>
<p>Modifies an existing table or view index (relational or XML) by disabling, rebuilding, or reorganizing the index; or by setting options on the index.</p>
<p><span id="more-36"></span></p>
<p><strong>DBCC DBREINDEX</strong></p>
<p>Rebuilds one or more indexes for a table in the specified database.</p>
<p>This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER INDEX instead.</p>
<p><strong>DBCC INDEXDEFRAG</strong></p>
<p>Defragments indexes of the specified table or view.This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER INDEX instead.
</p>
<p><strong>DBCC SHOWCONTIG</strong></p>
<p>Displays defragmentation information for data and indexes of a specified table.</p>
<p><strong>DBCC SHRINKDATABASE</strong></p>
<p>Shrinks the size of the data and log files in the specified database.</p>
<p><strong>DBCC SHRINKFILE</strong></p>
<p>Shrinks the size of the specified data or log file for the current database or  empties a file by moving the data from the specified file to other files in the  same filegroup, allowing the file to be removed from the database.</p>
<p><strong>KILL</strong></p>
<p>Terminates a user proces. It uses the spid as an identifier, and can therefore with benifit be used in combination with sp_who2.Notice &#8211; if the specified session ID has a lot of work to undo, the KILL statement may take  some time to complete, particularly when it involves rolling back a long  transaction.</p>
<p><strong>SP_LOCK</strong></p>
<p>Displays active locks.</p>
<p><strong>SP_SPACEUSED</strong></p>
<p>Displays the number of rows, disk space reserved, and disk space used by a table, indexed view, or SQL Server 2005 Service Broker queue in the current database, or displays the disk space reserved and used by the whole database.</p>
<p><strong>SP_WHO</strong></p>
<p>Displays information about current users and processes.</p>
<p><strong>SP_WHO2</strong></p>
<p>Displays information about current users and processes. It is a function similar to sp_who. The big difference is that it also displays CPU usages and DiskIO. So if possible, always use this command.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2006/04/some-usefull-sql-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

