<?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>SQL Tutorials</title>
	<atom:link href="http://www.sqltutorials.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sqltutorials.com</link>
	<description>SQL Tutorials - Learn SQL Queries and Joins with Pratical Examples</description>
	<lastBuildDate>Wed, 06 Jul 2011 19:44: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>A Puglet</title>
		<link>http://www.sqltutorials.com/a-puglet/</link>
		<comments>http://www.sqltutorials.com/a-puglet/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 19:40:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[A]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=349</guid>
		<description><![CDATA[pug·let / noun A baby pug, or an unusually small pug. Origin: Based on the word &#8220;piglet&#8221;.]]></description>
			<content:encoded><![CDATA[<p>pug·let / noun</p>
<p>A baby pug, or an unusually small pug.<br />
Origin: Based on the word &#8220;piglet&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/a-puglet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculate all table sizes in a database</title>
		<link>http://www.sqltutorials.com/calculate-all-table-sizes-in-a-database/</link>
		<comments>http://www.sqltutorials.com/calculate-all-table-sizes-in-a-database/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 12:01:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=339</guid>
		<description><![CDATA[Following on from the Count all rows in all tables in a database post, this script will calculate the size in kilobytes (kb) for each table in a database. Simply change the use statement to point to your database. USE [master] GO SELECT obj.name AS TableName, SUM(alloc.used_pages)*8 AS [SpaceUsed(KB)] FROM sys.objects obj JOIN sys.indexes idx [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the <a href="http://www.sqltutorials.com/count-all-rows-in-all-tables-in-a-database/">Count all rows in all tables in a database</a> post, this script will calculate the size in kilobytes (kb) for each table in a database. Simply change the use statement to point to your database.</p>
<div class="sqlwrapper">
<div class="sql" style="width: 600px;">USE [master]<br />
GO<br />
SELECT obj.name AS TableName, SUM(alloc.used_pages)*8 AS [SpaceUsed(KB)]<br />
FROM sys.objects obj<br />
JOIN sys.indexes idx on obj.object_id = idx.object_id<br />
JOIN sys.partitions prt on obj.object_id = prt.object_id<br />
JOIN sys.allocation_units alloc on alloc.container_id = prt.partition_id<br />
WHERE obj.type = &#8216;U&#8217; AND idx.index_id IN (0, 1)<br />
GROUP BY obj.name, prt.rows<br />
ORDER BY TableName</div>
</div>
<p>You should get a resultset like this (<em>I have cut my recordset down as it&#8217;s just an example</em>)</p>
<div class="sqlwrapper">
<table id="box-table-a" style="width: 400px;" summary="Result Table">
<thead>
<tr>
<th scope="col">TableName</th>
<th scope="col">SpaceUsed(KB)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Asset</td>
<td>400</td>
</tr>
<tr>
<td>AssetType</td>
<td>32</td>
</tr>
<tr>
<td>Company</td>
<td>88</td>
</tr>
<tr>
<td>CompanyVersion</td>
<td>0</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/calculate-all-table-sizes-in-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find Database Recovery Mode</title>
		<link>http://www.sqltutorials.com/find-database-recovery-mode/</link>
		<comments>http://www.sqltutorials.com/find-database-recovery-mode/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 11:52:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=337</guid>
		<description><![CDATA[Knowing which recovery mode your database is set to is essential. The following script will output the recovery mode for your database. Just remember to replace &#8216;yourdatabasename&#8216; with your database name! SELECT recovery_model_desc AS RecoveryMode FROM sys.databases WHERE name=&#8217;yourdatabasename&#8216; You should get a resultset like this RecoveryMode Simple]]></description>
			<content:encoded><![CDATA[<p>Knowing which recovery mode your database is set to is essential. The following script will output the recovery mode for your database. Just remember to replace &#8216;<em>yourdatabasename</em>&#8216; with your database name! <img src='http://www.sqltutorials.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="sqlwrapper">
<div class="sql" style="width: 400px;">SELECT recovery_model_desc AS RecoveryMode<br />
FROM sys.databases<br />
WHERE name=&#8217;<em>yourdatabasename</em>&#8216;</div>
</div>
<p>You should get a resultset like this</p>
<div class="sqlwrapper">
<table id="box-table-a" style="width: 200px;" summary="Result Table">
<thead>
<tr>
<th scope="col">RecoveryMode</th>
</tr>
</thead>
<tbody>
<tr>
<td>Simple</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/find-database-recovery-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Count all rows in all tables in a database</title>
		<link>http://www.sqltutorials.com/count-all-rows-in-all-tables-in-a-database/</link>
		<comments>http://www.sqltutorials.com/count-all-rows-in-all-tables-in-a-database/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 11:27:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=326</guid>
		<description><![CDATA[This script comes in very handy when you need to analyse database tables. Simply change the use statement to point to your database. USE [master] GO SELECT obj.name AS TableName, prt.rows AS TotalRows FROM sys.objects obj JOIN sys.indexes idx on obj.object_id = idx.object_id JOIN sys.partitions prt on obj.object_id = prt.object_id WHERE obj.type = &#8216;U&#8217; AND [...]]]></description>
			<content:encoded><![CDATA[<p>This script comes in very handy when you need to analyse database tables. Simply change the use statement to point to your database.</p>
<div class="sqlwrapper">
<div class="sql" style="width: 600px;">USE [master]<br />
GO<br />
SELECT obj.name AS TableName, prt.rows AS TotalRows<br />
FROM sys.objects obj<br />
JOIN sys.indexes idx on obj.object_id = idx.object_id<br />
JOIN sys.partitions prt on obj.object_id = prt.object_id<br />
WHERE obj.type = &#8216;U&#8217; AND idx.index_id IN (0, 1)<br />
GROUP BY obj.name, prt.rows<br />
ORDER BY TableName</div>
</div>
<p>You should get a resultset like this (<em>I have cut my recordset down as it&#8217;s just an example</em>)</p>
<div class="sqlwrapper">
<table id="box-table-a" style="width: 400px;" summary="Result Table">
<thead>
<tr>
<th scope="col">TableName</th>
<th scope="col">TotalRows</th>
</tr>
</thead>
<tbody>
<tr>
<td>Asset</td>
<td>1142</td>
</tr>
<tr>
<td>AssetType</td>
<td>16</td>
</tr>
<tr>
<td>Company</td>
<td>424</td>
</tr>
<tr>
<td>CompanyVersion</td>
<td>0</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/count-all-rows-in-all-tables-in-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List all processes running on SQL Server</title>
		<link>http://www.sqltutorials.com/list-all-processes-running-on-sql-server/</link>
		<comments>http://www.sqltutorials.com/list-all-processes-running-on-sql-server/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 17:27:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=322</guid>
		<description><![CDATA[You might need to see all the processes that are currently running on your SQL server. This simply query will help you out! SELECT [Database]=DB_NAME(dbid), spid, last_batch, status, hostname, loginame FROM sys.sysprocesses WHERE dbid = DB_ID(&#8216;master&#8217;); You should get a resultset like this (I have cut my resordset down as it&#8217;s just an example) Database [...]]]></description>
			<content:encoded><![CDATA[<p>You might need to see all the processes that are currently running on your SQL server. This simply query will help you out!</p>
<div class="sqlwrapper">
<div class="sql" style="width:400px;">SELECT [Database]=DB_NAME(dbid), spid, last_batch, status, hostname, loginame<br />
FROM sys.sysprocesses<br />
WHERE dbid = DB_ID(&#8216;master&#8217;);
</div>
</div>
<p>You should get a resultset like this (<em>I have cut my resordset down as it&#8217;s just an example</em>)</p>
<div class="sqlwrapper">
<table id="box-table-a" summary="Result Table" style="width:600px;">
<thead>
<tr>
<th scope="col">Database</th>
<th scope="col">spid</th>
<th scope="col">last_batch</th>
<th scope="col">status</th>
<th scope="col">hostname</th>
<th scope="col">loginame</th>
</tr>
</thead>
<tbody>
<tr>
<td>master</td>
<td>21</td>
<td>2011-01-17 08:29:06.290</td>
<td>sleeping</td>
<td></td>
<td>sa</td>
</tr>
<tr>
<td>master</td>
<td>61</td>
<td>2011-02-22 15:57:06.897</td>
<td>sleeping</td>
<td>D114-LDN</td>
<td>D114-LDN\admin</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/list-all-processes-running-on-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get database ID from MS SQL Server</title>
		<link>http://www.sqltutorials.com/get-database-id-from-ms-sql-server/</link>
		<comments>http://www.sqltutorials.com/get-database-id-from-ms-sql-server/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 17:03:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=318</guid>
		<description><![CDATA[To get the database ID quickly simply execute this query with your database name SELECT db_id(&#8216;yourdatabasename&#8217;) AS DatabaseID You should get a resultset like this DatabaseID 11]]></description>
			<content:encoded><![CDATA[<p>To get the database ID quickly simply execute this query with your database name</p>
<div class="sqlwrapper">
<div class="sql" style="width:400px;">SELECT db_id(&#8216;yourdatabasename&#8217;) AS DatabaseID
</div>
</div>
<p>You should get a resultset like this</p>
<div class="sqlwrapper">
<table id="box-table-a" summary="Result Table" style="width:200px;">
<thead>
<tr>
<th scope="col">DatabaseID</th>
</tr>
</thead>
<tbody>
<tr>
<td>11</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/get-database-id-from-ms-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Last Restart Time</title>
		<link>http://www.sqltutorials.com/last-restart-time/</link>
		<comments>http://www.sqltutorials.com/last-restart-time/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 16:56:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=312</guid>
		<description><![CDATA[Knowing when the last time SQL was restarted is sometimes a handy figure to have. Every time your SQL Server service restarts tempdb is recreated so simply run this query and see when your SQL server was last rebooted! SELECT create_date AS last_restart_time FROM sys.databases WHERE name = &#8216;tempdb&#8217; You should get a resultset like [...]]]></description>
			<content:encoded><![CDATA[<p>Knowing when the last time SQL was restarted is sometimes a handy figure to have. Every time your SQL Server service restarts tempdb is recreated so simply run this query and see when your SQL server was last rebooted!</p>
<div class="sqlwrapper">
<div class="sql" style="width:400px;">SELECT create_date AS last_restart_time<br />
FROM sys.databases<br />
WHERE  name = &#8216;tempdb&#8217;
</div>
</div>
<p>You should get a resultset like this</p>
<div class="sqlwrapper">
<table id="box-table-a" summary="Result Table" style="width:200px;">
<thead>
<tr>
<th scope="col">last_restart_time</th>
</tr>
</thead>
<tbody>
<tr>
<td>2011-01-17 08:28:41.340</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/last-restart-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to identify your SQL Server version and edition</title>
		<link>http://www.sqltutorials.com/how-to-identify-your-sql-server-version-and-edition/</link>
		<comments>http://www.sqltutorials.com/how-to-identify-your-sql-server-version-and-edition/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 15:49:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.sqltutorials.com/?p=301</guid>
		<description><![CDATA[To identify your SQL server version and edition simply create a new query and running one of the following code snippet. SQL Server 2008 SELECT SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;) SQL Server 2005 SELECT SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;) SQL Server 2000 SELECT SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;)]]></description>
			<content:encoded><![CDATA[<p>To identify your SQL server version and edition simply create a new query and running one of the following code snippet.</p>
<h2>SQL Server 2008</h2>
<div class="sqlwrapper">
<div class="sql" style="width:400px;">SELECT SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;)
</div>
</div>
<h2>SQL Server 2005</h2>
<div class="sqlwrapper">
<div class="sql" style="width:400px;">SELECT  SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;)
</div>
</div>
<h2>SQL Server 2000</h2>
<div class="sqlwrapper">
<div class="sql" style="width:400px;">SELECT  SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;)
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqltutorials.com/how-to-identify-your-sql-server-version-and-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

