<?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>zlika&#039;s &#187; SSMS</title>
	<atom:link href="http://zlika.org/index.php/tag/ssms/feed/" rel="self" type="application/rss+xml" />
	<link>http://zlika.org</link>
	<description>Think SMART!</description>
	<lastBuildDate>Fri, 06 Apr 2012 03:09:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>How to store UTF-8 data in SQL Server</title>
		<link>http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/</link>
		<comments>http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 22:09:02 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=704</guid>
		<description><![CDATA[Very frequently we need to use the data type UTF-8 to store a data in different languages. As described in the MSDN page the UTF-8 data type is stored in the &#8216;Samples&#8217; folder in SQL Server (Server\100\Samples\Engine\Programmability\CLR\UTF8String). You just need to activate it.

Create data type UTF-8
1. Generate a strong name key file
1.1. Open Command Prompt [...]]]></description>
			<content:encoded><![CDATA[<p>Very frequently we need to use the data type UTF-8 to store a data in different languages. As described in the <a title="Readme_UTF8 UDT Sample" href="http://msdn.microsoft.com/en-us/library/ms160893(SQL.100).aspx" target="_blank">MSDN page</a> the UTF-8 data type is stored in the &#8216;Samples&#8217; folder in SQL Server (Server\100\Samples\Engine\Programmability\CLR\UTF8String). You just need to activate it.</p>
<p><span id="more-704"></span><br />
<strong><span style="text-decoration: underline;">Create data type UTF-8</span></strong></p>
<p><strong>1. Generate a strong name key file</strong><br />
1.1. Open Command Prompt (Start &#8211;&gt; Run &#8211;&gt; &#8216;cmd&#8217;)<br />
1.2. Change directory (C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin)<br />
1.3. Generate the key (C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin&gt;sn -k &#8220;C:\Program Files\Microsoft SQL Server\100\Samples\SampleKey.snk&#8221;)</p>
<p><strong>2. Build the sample</strong><br />
2.1. Open Microsoft Visual Studio<br />
2.2. Open &#8216;C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\CLR\UTF8String\CS\UTF8String.sln&#8217;<br />
2.3. Build &#8211;&gt; Build UTF8String</p>
<p><strong>3. Install UTF-8 data type</strong><br />
3.1. Open SQL Server Management Studio<br />
3.2. Open &#8216;C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\CLR\UTF8String\Scripts\InstallCS.sql&#8217;<br />
3.3. Execute it<br />
3.4. Test UTF-8 data type (C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\CLR\UTF8String\Scripts\Test.sql)<br />
3.4.1. Fix the error message &#8216;<span style="color: #ff0000;">Msg 6263, Level 16, State 1, Line 2<br />
Execution of user code in the .NET Framework is disabled. Enable &#8220;clr enabled&#8221; configuration option.</span>&#8216;</p>
<pre class="brush: sql;">
sp_configure 'clr enabled', 1;
RECONFIGURE;
</pre>
<p>3.4.2. Test UTF-8</p>
<pre class="brush: sql;">
DECLARE @u Utf8String;
SET @u = CONVERT(Utf8String, 'hello world');
SELECT
	@u.ToString()
	, CONVERT(varbinary(8000), @u)
	, SUBSTRING(@u.ToString(), 1, 5)
	, @u.Utf8Bytes;
</pre>
<div id="attachment_732" class="wp-caption aligncenter" style="width: 759px"><a href="http://zlika.org/wp-content/uploads/2011/03/02.png" rel="lightbox[704]"><img src="http://zlika.org/wp-content/uploads/2011/03/02.png" alt="" title="The result" width="749" height="75" class="size-full wp-image-732" /></a><p class="wp-caption-text">The result</p></div>
<p><strong><span style="text-decoration: underline;">Create PHP form to insert a UTF-8 data</span></strong></p>
<p><strong>1. Create table</strong></p>
<pre class="brush: sql;">
USE zlika;

CREATE TABLE CharsetTest
(
	[Language] VARCHAR(50)
	, [Phrase] UTF8String
);
</pre>
<p><strong>2. Create PHP form (insert.php)</strong></p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
	&lt;title&gt;Charset Test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php
// Connect to SQL Server
$server = 'ZLIKA';
$username = 'zlika';
$password = 'myPassword';
$connect = mssql_connect($server, $username, $password) or die ('No server connection!');
$sqldb = mssql_select_db('zlika', $connect) or die ('No database connection!');

// Get the variables
$language = $_POST['language'];
$phrase = $_POST['phrase'];

// Insert records in the database
$query = &quot;INSERT INTO CharsetTest (Language, Phrase) SELECT '&quot; . $language . &quot;', '&quot; . $phrase . &quot;'&quot;;
$result = mssql_query($query);

// Close database connection
mssql_close($connect);
?&gt;

&lt;form action=&quot;insert.php&quot; method=&quot;post&quot;&gt;
	Language: &lt;input name=&quot;language&quot; /&gt;&lt;br /&gt;
	Phrase: &lt;input name=&quot;phrase&quot; /&gt;&lt;br /&gt;
	&lt;input type=&quot;Submit&quot; /&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>3. Insert test data</strong></p>
<blockquote><p>Bulgarian &#8211;&gt; Честита Нова Година!<br />
Arabic &#8211;&gt; سنة جديدة سعيدة!<br />
Armenian &#8212; &gt; Շնորհավոր Նոր Տարի<br />
Azarbaijani &#8211;&gt; Yeni iliniz mübarək<br />
Catalan &#8211;&gt; Feliç Any Nou!<br />
Chinese (Traditional) &#8211;&gt; 新年快樂<br />
Polish &#8211;&gt; Szczęśliwego Nowego Roku!<br />
Thai &#8211;&gt; สวัสดีปีใหม่<br />
hindi &#8211;&gt; नया साल मुबारक हो</p></blockquote>
<p><strong>4. Check the content of the table (check.php)</strong></p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
	&lt;title&gt;Charset Test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php

// Connect to SQL Server
$server = 'ZLIKA';
$username = 'zlika';
$password = 'myPassword';
$connect = mssql_connect($server, $username, $password) or die ('No server connection!');
$sqldb = mssql_select_db('zlika', $connect) or die ('No database connection!');

// Select the data
$query = 'SELECT Language, Phrase.ToString() AS Phrase FROM CharsetTest';
$result = mssql_query($query);

//Retrieving data Header
echo '&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; width=&quot;100%&quot;&gt;&lt;tr&gt;';

$i = 0;
while ($i &lt; mssql_num_fields($result))
{
	echo '&lt;th&gt;'. mssql_field_name($result, $i) . '&lt;/th&gt;';
	$i++;
}
echo '&lt;/tr&gt;';

//Retrieving rows
while ($row = mssql_fetch_array($result, MSSQL_ASSOC))
{
	echo '&lt;tr&gt;';
	foreach ($row as $data)
	{
		echo '&lt;td&gt;' . $data . '&lt;/td&gt;';
	}
	echo'&lt;/tr&gt;';
}

echo '&lt;/table&gt;';

// Close database connection
mssql_close($connect);

?&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The result:</p>
<div id="attachment_723" class="wp-caption aligncenter" style="width: 353px"><a href="http://zlika.org/wp-content/uploads/2011/03/01.png" rel="lightbox[704]"><img class="size-full wp-image-723" title="The result" src="http://zlika.org/wp-content/uploads/2011/03/01.png" alt="" width="343" height="248" /></a><p class="wp-caption-text">The result</p></div>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="How to store UTF-8 data in SQL Server" href="http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/"><b>How to store UTF-8 data in SQL Server</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/category/it/php/" title="View all posts in PHP" rel="category tag">PHP</a>, <a href="http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/&title=How to store UTF-8 data in SQL Server">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/&t=How to store UTF-8 data in SQL Server">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/&title=How to store UTF-8 data in SQL Server">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/&title=How to store UTF-8 data in SQL Server">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/&title=How to store UTF-8 data in SQL Server">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2011, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2011/03/06/how-to-store-utf-8-data-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Equal Action to Identical Databases</title>
		<link>http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/</link>
		<comments>http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:42:58 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Transact-SQL]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SSMS]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=636</guid>
		<description><![CDATA[If I administer 345 identical databases I can do equal action to all of them (or some of them) easy by selecting the names of the databases, generate dynamic code, execute it and select the result and the errors (is any).

In this example I will select the names of the databases, create dynamic code and [...]]]></description>
			<content:encoded><![CDATA[<p>If I administer 345 identical databases I can do equal action to all of them (or some of them) easy by selecting the names of the databases, generate dynamic code, execute it and select the result and the errors (is any).</p>
<p><span id="more-636"></span><br />
In this example I will select the names of the databases, create dynamic code and execute it. Next, in case of result or errors &#8211; create temporary &#8216;Result&#8217; or/and &#8216;Errors&#8217; table/s. The database zlika1 differs (column name &#8216;FirstName1&#8242; on line 16) from the others to generate an error. </p>
<pre class="brush: sql; highlight: [16];">
-- Create databases
CREATE DATABASE zlika1
CREATE DATABASE zlika2
CREATE DATABASE zlika3
GO

-- Create Tables
CREATE TABLE zlika1.dbo.Names
(
	FirstName NVARCHAR(50)
	, LastName NVARCHAR(50)
)

CREATE TABLE zlika2.dbo.Names
(
	FirstName1 NVARCHAR(50)
	, LastName NVARCHAR(50)
)

CREATE TABLE zlika3.dbo.Names
(
	FirstName NVARCHAR(50)
	, LastName NVARCHAR(50)
)

-- Populate Tables
INSERT INTO zlika1.dbo.Names VALUES ('z_FirstName', 'z_Lastname')
INSERT INTO zlika2.dbo.Names VALUES ('z1_FirstName', 'z1_Lastname')
INSERT INTO zlika3.dbo.Names VALUES ('z2_FirstName', 'z2_Lastname')
GO
</pre>
<p>And the script&#8230; The code that will be executes to all databases is on line 42. in this example I select the first and last names of the &#8216;Names&#8217; table from all databases which name starts with &#8216;zlika&#8217;.</p>
<pre class="brush: sql; highlight: [42];">
USE master
GO

-- Declare variables
DECLARE @DBName NVARCHAR(100), @Rows INT, @SQL VARCHAR(max)

-- Delete Temp Table
IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#TempTable%')
	DROP TABLE #TempTable

IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Result%')
	DROP TABLE #Result

IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Errors%')
	DROP TABLE #Errors

-- Populate Temp Table
SELECT [name]
INTO #TempTable
FROM sys.databases
WHERE [name] LIKE 'zlika%'

-- Count rows in Temp Table
SELECT @Rows = COUNT([name])
FROM #TempTable

-- Cycle
WHILE (@Rows) &gt; 0
BEGIN
	SELECT TOP 1 @DBName = [name] FROM #TempTable
	---------- Do Something Start ----------
	BEGIN TRY
		IF NOT EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Result%')
			BEGIN
				CREATE TABLE #Result
				(
					DatabaseName NVARCHAR(50)
					, FirstName NVARCHAR(50)
					, LastName NVARCHAR(50)
				)
			END
		SELECT @SQL = 'INSERT INTO #Result SELECT ''' + @DBName + ''', FirstName, LastName FROM ' + @DBName + '.dbo.Names'
		EXEC (@SQL)
	END TRY

	BEGIN CATCH
		IF NOT EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Errors%')
			BEGIN
				CREATE TABLE #Errors
				(
					DatabaseName NVARCHAR(100)
					, ErrorNumber INT
					, ErrorMessage NVARCHAR(250)
				)
			END
		INSERT INTO #Errors VALUES (@DBName, ERROR_NUMBER(), ERROR_MESSAGE())
	END CATCH
	---------- Do Something End ----------
	DELETE FROM #TempTable WHERE [name] = @DBName
	SET @Rows = @Rows - 1
END

IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Result%')
	SELECT *
	FROM #Result

IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Errors%')
	SELECT *
	FROM #Errors

-- Clean up
DROP TABLE #TempTable

IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Result%')
	DROP TABLE #Result

IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE [name] LIKE '#Errors%')
	DROP TABLE #Errors
GO
</pre>
<p>The result &#8211; two rows, corresponding to &#8216;zlika1&#8242; and &#8216;zlika3&#8242; databases and one error, corresponding to &#8216;zlika2&#8242; database.<br />
<div id="attachment_671" class="wp-caption aligncenter" style="width: 472px"><a href="http://zlika.org/wp-content/uploads/2010/11/01.png" rel="lightbox[636]"><img src="http://zlika.org/wp-content/uploads/2010/11/01.png" alt="" title="Result - two selected rows and one error" width="462" height="194" class="size-full wp-image-671" /></a><p class="wp-caption-text">Result - two selected rows and one error</p></div></p>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="Equal Action to Identical Databases" href="http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/"><b>Equal Action to Identical Databases</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/sql/" title="View all posts in Transact-SQL" rel="category tag">Transact-SQL</a>, <a href="http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/&title=Equal Action to Identical Databases">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/&t=Equal Action to Identical Databases">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/&title=Equal Action to Identical Databases">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/&title=Equal Action to Identical Databases">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/&title=Equal Action to Identical Databases">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/11/15/equal-action-to-identical-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select server logins and their roles in SQL Server</title>
		<link>http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/</link>
		<comments>http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 21:25:37 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=540</guid>
		<description><![CDATA[To view all the server logins and their roles I use the system view sys.syslogins and CASE to convert 1 to &#8220;Yes&#8221; and 0 to &#8220;No&#8221;.


-- Select all database logins and their server roles
USE master
GO

SELECT
	[name] AS [Login]
	, CASE sysadmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [sysadmin]
	, CASE securityadmin WHEN [...]]]></description>
			<content:encoded><![CDATA[<p>To view all the server logins and their roles I use the system view <a title="sys.syslogins" href="http://msdn.microsoft.com/en-us/library/ms178593.aspx" target="_blank">sys.syslogins</a> and <a title="CASE" href="http://msdn.microsoft.com/en-us/library/ms181765.aspx" target="_blank">CASE</a> to convert 1 to &#8220;Yes&#8221; and 0 to &#8220;No&#8221;.</p>
<p><span id="more-540"></span></p>
<pre class="brush: sql;">
-- Select all database logins and their server roles
USE master
GO

SELECT
	[name] AS [Login]
	, CASE sysadmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [sysadmin]
	, CASE securityadmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [securityadmin]
	, CASE serveradmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [serveradmin]
	, CASE setupadmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [setupadmin]
	, CASE processadmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [processadmin]
	, CASE diskadmin WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [diskadmin]
	, CASE dbcreator WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'N/A' END AS [dbcreator]

FROM sys.syslogins
GO
</pre>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="Select server logins and their roles in SQL Server" href="http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/"><b>Select server logins and their roles in SQL Server</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/&title=Select server logins and their roles in SQL Server">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/&t=Select server logins and their roles in SQL Server">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/&title=Select server logins and their roles in SQL Server">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/&title=Select server logins and their roles in SQL Server">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/&title=Select server logins and their roles in SQL Server">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/10/24/select-server-logins-and-their-roles-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filegroups and Autogrowth in MS SQL Server</title>
		<link>http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/</link>
		<comments>http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 03:27:10 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=464</guid>
		<description><![CDATA[Yesterday I was asked about the way a table is stored in several files in a filegroup.

The current example explains it. First, I create a database, containing two secondary data files in a filegroup.

CREATE DATABASE zlika ON PRIMARY
(
	NAME = N'zlika'
	, FILENAME = N'C:\Databases\zlika.mdf'
)
,

FILEGROUP zlikaGroup
(
	NAME = N'fg1_1'
	, FILENAME = N'C:\Databases\fg1_1.ndf'
)
,
(
	NAME = N'fg1_2'
	, FILENAME = N'C:\Databases\fg1_2.ndf'
)

LOG ON
(
	NAME [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was asked about the way a table is stored in several files in a filegroup.</p>
<p><span id="more-464"></span></p>
<p>The current example explains it. First, I create a database, containing two secondary data files in a filegroup.</p>
<pre class="brush: sql;">
CREATE DATABASE zlika ON PRIMARY
(
	NAME = N'zlika'
	, FILENAME = N'C:\Databases\zlika.mdf'
)
,

FILEGROUP zlikaGroup
(
	NAME = N'fg1_1'
	, FILENAME = N'C:\Databases\fg1_1.ndf'
)
,
(
	NAME = N'fg1_2'
	, FILENAME = N'C:\Databases\fg1_2.ndf'
)

LOG ON
(
	NAME = N'zlika_log'
	, FILENAME = N'C:\Databases\zlika_log.ldf'
)
GO
</pre>
<p>The sizes of the files are as follow:</p>
<div id="attachment_465" class="wp-caption aligncenter" style="width: 182px"><a href="http://zlika.org/wp-content/uploads/2010/09/01.jpg" rel="lightbox[464]"><img class="size-full wp-image-465" title="File sizes after creation of the database" src="http://zlika.org/wp-content/uploads/2010/09/01.jpg" alt="" width="172" height="73" /></a><p class="wp-caption-text">File sizes after creation of the database</p></div>
<p>Next I create a table that stores its rows in the filegroup</p>
<pre class="brush: sql;">
USE zlika
GO

CREATE TABLE TestTable
(
	ID INT IDENTITY NOT NULL
	, FirstName VARCHAR(50) NOT NULL
	, LastName VARCHAR(50) NOT NULL
)
ON zlikaGroup
GO
</pre>
<p>I populate the table with any information</p>
<pre class="brush: sql;">
USE zlika
GO

INSERT INTO TestTable VALUES ('George', 'Henderson')
GO 50000
</pre>
<p>The sizes of the files are as follow:</p>
<div id="attachment_467" class="wp-caption aligncenter" style="width: 181px"><a href="http://zlika.org/wp-content/uploads/2010/09/02.jpg" rel="lightbox[464]"><img class="size-full wp-image-467" title="File sizes after the population of the table" src="http://zlika.org/wp-content/uploads/2010/09/02.jpg" alt="" width="171" height="69" /></a><p class="wp-caption-text">File sizes after the population of the table</p></div>
<p>I execute the same script and check the sizes of the files once again:</p>
<div id="attachment_468" class="wp-caption aligncenter" style="width: 182px"><a href="http://zlika.org/wp-content/uploads/2010/09/03.jpg" rel="lightbox[464]"><img class="size-full wp-image-468" title="File sizes after adding more data" src="http://zlika.org/wp-content/uploads/2010/09/03.jpg" alt="" width="172" height="69" /></a><p class="wp-caption-text">File sizes after adding more data</p></div>
<p>The answer is: MS SQL Server stores the data in several files in a filegroup according to their Autogrowth settings. The database I have created autogrows the secondary data files by 1MB:</p>
<div id="attachment_469" class="wp-caption aligncenter" style="width: 585px"><a href="http://zlika.org/wp-content/uploads/2010/09/04.jpg" rel="lightbox[464]"><img class="size-full wp-image-469" title="The properties of the database - Files" src="http://zlika.org/wp-content/uploads/2010/09/04.jpg" alt="" width="575" height="118" /></a><p class="wp-caption-text">The properties of the database - Files</p></div>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="Filegroups and Autogrowth in MS SQL Server" href="http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/"><b>Filegroups and Autogrowth in MS SQL Server</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/&title=Filegroups and Autogrowth in MS SQL Server">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/&t=Filegroups and Autogrowth in MS SQL Server">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/&title=Filegroups and Autogrowth in MS SQL Server">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/&title=Filegroups and Autogrowth in MS SQL Server">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/&title=Filegroups and Autogrowth in MS SQL Server">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/09/18/filegroups-and-autogrowth-in-ms-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DENSE_RANK() function in MS SQL Server</title>
		<link>http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/</link>
		<comments>http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 04:46:24 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[Transact-SQL]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SSMS]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=430</guid>
		<description><![CDATA[As we can read in Books Online in SQL Server
Ranking functions return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are nondeterministic.
I have created simple example for usage of the Ranking function DENSE_RANK().

We have a [...]]]></description>
			<content:encoded><![CDATA[<p>As we can read in Books Online in SQL Server</p>
<blockquote><p>Ranking functions return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are nondeterministic.</p></blockquote>
<p>I have created simple example for usage of the Ranking function DENSE_RANK().</p>
<p><span id="more-430"></span></p>
<p>We have a database with the addresses of all the residents of a city. Many of them have changed their addresses several times. They have changed them by using web application, because the authorities have decided that&#8217;s the most convenient manner for everybody. Down the years, one user may have more then one record (change of address). We need to select only one actual address or only one precedent address per user. We need to partition the table and select only the data we need.</p>
<p>First I create the tables, keys and I populate them.</p>
<pre class="brush: sql;">USE zlika
GO

-- Create Tables and keys
CREATE TABLE [Users]
(
	[ID] INT IDENTITY (1, 1) PRIMARY KEY
	, [FirstName] VARCHAR(50)
	, [LastName] VARCHAR(50)
)
GO

CREATE TABLE [Address]
(
	[ID] INT IDENTITY (1, 1) PRIMARY KEY
	, [UserID] INT
	, [StreetNo] INT
	, [StreetName] VARCHAR(100)
	, [City] VARCHAR(100)
	, [Phone] VARCHAR(25)
	, [DateOfRegistration] DATETIME NULL
)
GO

ALTER TABLE [Address]
WITH CHECK ADD CONSTRAINT
FK_Users_ID FOREIGN KEY
(
	UserID
)
REFERENCES Users
(
	ID
)
GO

ALTER TABLE [Address]
ADD CONSTRAINT DF_Address_DateOfRegistration
	DEFAULT (GETDATE())
	FOR DateOfRegistration
GO

-- Populate Tables
INSERT INTO [Users] (FirstName, LastName) VALUES
('First', 'Smith')
, ('Second', 'George')
, ('Third', 'Thompson')
GO

SELECT * FROM Users
GO

INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (1, 111, 'StreetName1', 'City1', 11111)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (1, 222, 'StreetName2', 'City2', 22222)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (1, 333, 'StreetName3', 'City3', 33333)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (1, 444, 'StreetName4', 'City4', 44444)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (1, 555, 'StreetName5', 'City5', 55555)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (2, 1111, 'StreetName11', 'City11', 1111111111)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (2, 2222, 'StreetName22', 'City22', 2222222222)
WAITFOR DELAY '00:00:01'
INSERT INTO [Address] (UserID, StreetNo, StreetName, City, Phone) VALUES (3, 3, 'StreetName333', 'City333', 333)
GO

SELECT * FROM [Address]
GO
</pre>
<p>Users table contains three rows as follow:</p>
<div id="attachment_436" class="wp-caption aligncenter" style="width: 233px"><a href="http://zlika.org/wp-content/uploads/2010/08/01.png" rel="lightbox[430]"><img class="size-full wp-image-436" title="Users Table" src="http://zlika.org/wp-content/uploads/2010/08/01.png" alt="" width="223" height="113" /></a><p class="wp-caption-text">Users Table</p></div>
<p>Address table contains eight rows for these three users:</p>
<div id="attachment_439" class="wp-caption aligncenter" style="width: 619px"><a href="http://zlika.org/wp-content/uploads/2010/08/02.png" rel="lightbox[430]"><img class="size-full wp-image-439" title="Address Table" src="http://zlika.org/wp-content/uploads/2010/08/02.png" alt="" width="609" height="217" /></a><p class="wp-caption-text">Address Table</p></div>
<p>We need to partition the table. That means we need to split the data according to some logic. DANSE_RANK() function does it for us. It split users by their ID (UserID), order the partitions descending by date and adds ranks.</p>
<pre class="brush: sql; highlight: [18,19];">
SELECT
	A.ID
	, A.UserID
	, U.FirstName
	, U.LastName
	, A.StreetNo
	, A.StreetName
	, A.City
	, A.Phone
	, A.DateOfRegistration
	, DENSE_RANK() OVER (PARTITION BY UserID ORDER BY DateOfRegistration DESC) AS [Rank]

FROM
	[Address] AS A
	INNER JOIN dbo.[Users] AS U
		ON A.UserID = U.ID

--WHERE
--	[Rank] = 2
GO
</pre>
<p>The result of the query is the data plus a temporary column for ranking.</p>
<div id="attachment_441" class="wp-caption aligncenter" style="width: 813px"><a href="http://zlika.org/wp-content/uploads/2010/08/03.png" rel="lightbox[430]"><img class="size-full wp-image-441  " title="Adding DENSE_RANK column" src="http://zlika.org/wp-content/uploads/2010/08/03.png" alt="" width="803" height="216" /></a><p class="wp-caption-text">Adding DENSE_RANK column (click on image)</p></div>
<p>If I try to reach the result in single query (uncommenting lines 18 and 19), I&#8217;ll get &#8220;Invalid column name &#8216;Rank&#8217;&#8221; error. The reason is that I generate the [Rank] column during the selection of the data and I can&#8217;t filter it at this time.</p>
<div id="attachment_444" class="wp-caption aligncenter" style="width: 756px"><a href="http://zlika.org/wp-content/uploads/2010/08/04.png" rel="lightbox[430]"><img class="size-full wp-image-444" title="Invalid column name 'Rank'" src="http://zlika.org/wp-content/uploads/2010/08/04.png" alt="" width="746" height="355" /></a><p class="wp-caption-text">Invalid column name &#39;Rank&#39;</p></div>
<p>To get the data that I need, I simulate a View &#8211; create a temporary table and read a filtered data from it.</p>
<pre class="brush: sql;">
USE zlika
GO

CREATE TABLE #Temp
(
	ID INT
	, [UserID] INT
	, [FirstName] VARCHAR(50)
	, [LastName] VARCHAR(50)
	, [StreetNo] INT
	, [StreetName] VARCHAR(100)
	, [City] VARCHAR(100)
	, [Phone] VARCHAR(25)
	, [DateOfRegistration] DATETIME NULL
	, [Rank] INT
)
GO

INSERT INTO #Temp
SELECT
	A.ID
	, A.UserID
	, U.FirstName
	, U.LastName
	, A.StreetNo
	, A.StreetName
	, A.City
	, A.Phone
	, DateOfRegistration, DENSE_RANK() OVER (PARTITION BY UserID ORDER BY DateOfRegistration DESC) AS [Rank]

FROM
	[Address] AS A
	INNER JOIN dbo.[Users] AS U
		ON A.UserID = U.ID
GO

SELECT
	ID
	, UserID
	, FirstName
	, LastName
	, StreetNo
	, StreetName
	, City
	, Phone
	, DateOfRegistration

FROM
	#Temp

WHERE
	[Rank] = 1

ORDER BY
	UserID
GO

DROP TABLE #Temp
GO
</pre>
<p>The result is the last address of the residents. If we need the precedent addresses, we&#8217;ll filter the [Rank] column to equals 2.</p>
<div id="attachment_445" class="wp-caption aligncenter" style="width: 768px"><a href="http://zlika.org/wp-content/uploads/2010/08/05.png" rel="lightbox[430]"><img class="size-full wp-image-445" title="DENSE_RANK result" src="http://zlika.org/wp-content/uploads/2010/08/05.png" alt="" width="758" height="115" /></a><p class="wp-caption-text">DENSE_RANK result</p></div>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="DENSE_RANK() function in MS SQL Server" href="http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/"><b>DENSE_RANK() function in MS SQL Server</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/category/it/sql/" title="View all posts in Transact-SQL" rel="category tag">Transact-SQL</a>, <a href="http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/&title=DENSE_RANK() function in MS SQL Server">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/&t=DENSE_RANK() function in MS SQL Server">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/&title=DENSE_RANK() function in MS SQL Server">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/&title=DENSE_RANK() function in MS SQL Server">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/&title=DENSE_RANK() function in MS SQL Server">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/08/04/simple-usage-of-dense_rank-function-in-ms-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The difference between WHERE and HAVING filters in SQL Server</title>
		<link>http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/</link>
		<comments>http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 02:44:51 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[Transact-SQL]]></category>
		<category><![CDATA[SSMS]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=367</guid>
		<description><![CDATA[The difference between WHERE and HAVING filters in Transact-SQL queries is that WHERE clause is a filter of all the data, while HAVING filters the GROUP BY data. I&#8217;ve prepared a simple example.


USE zlika
GO

-- Create table
CREATE TABLE test (
	Date DATETIME
	, QTY INT
)
GO

-- Populate table
INSERT INTO test (Date, QTY)
SELECT '2009-05-10', 1
UNION ALL SELECT '2009-05-10', 2
UNION ALL [...]]]></description>
			<content:encoded><![CDATA[<p>The difference between WHERE and HAVING filters in Transact-SQL queries is that WHERE clause is a filter of all the data, while HAVING filters the GROUP BY data. I&#8217;ve prepared a simple example.</p>
<p><span id="more-367"></span></p>
<pre class="brush: sql;">
USE zlika
GO

-- Create table
CREATE TABLE test (
	Date DATETIME
	, QTY INT
)
GO

-- Populate table
INSERT INTO test (Date, QTY)
SELECT '2009-05-10', 1
UNION ALL SELECT '2009-05-10', 2
UNION ALL SELECT '2009-05-10', 3
UNION ALL SELECT '2009-05-11', 4
UNION ALL SELECT '2009-05-11', 5
UNION ALL SELECT '2009-05-11', 6
UNION ALL SELECT '2009-05-12', 7
UNION ALL SELECT '2009-05-12', 8
UNION ALL SELECT '2009-05-12', 9
GO

-- Check the table
SELECT
	CONVERT(CHAR(10), Date, 103) AS Date
	, QTY

FROM
	test
GO
</pre>
<p>The content of the table is as follows:</p>
<div id="attachment_369" class="wp-caption aligncenter" style="width: 189px"><a href="http://zlika.org/wp-content/uploads/2010/04/01.png" rel="lightbox[367]"><img src="http://zlika.org/wp-content/uploads/2010/04/01.png" alt="" title="Content of the table" width="179" height="232" class="size-full wp-image-369" /></a><p class="wp-caption-text">Content of the table</p></div>
<p>If we GROUP BY column QTY, the result is different sums of the QTY column:<br />
May 10, 2009, 1 + 2 + 3 = 6<br />
May 11, 2009, 4 + 5 + 6 = 15<br />
May 12, 2009, 7 + 8 + 9 = 24</p>
<pre class="brush: sql;">
USE zlika
GO

-- GROUP BY (no filters)
SELECT
	CONVERT(CHAR(10), Date, 103) AS Date
	, SUM(QTY) AS QTY

FROM
	test

GROUP BY
	Date
GO
</pre>
<div id="attachment_371" class="wp-caption aligncenter" style="width: 183px"><a href="http://zlika.org/wp-content/uploads/2010/04/02.png" rel="lightbox[367]"><img src="http://zlika.org/wp-content/uploads/2010/04/02.png" alt="" title="GROPU BY filter" width="173" height="112" class="size-full wp-image-371" /></a><p class="wp-caption-text">GROPU BY filter</p></div>
<p>If we exclude the &#8217;6&#8242; in the WHERE clause, it&#8217;s gonna be filtered before the grouping of the date. The line No. 6 will be eliminated and the May 11, 2009 will be grouped like 4 + 5 = 9.</p>
<pre class="brush: sql;">
USE zlika
GO

-- GROUP BY (WHERE filter)
SELECT
	CONVERT(CHAR(10), Date, 103) AS Date
	, SUM(QTY) AS QTY

FROM
	test

WHERE
	QTY &lt;&gt; 6

GROUP BY
	Date
GO
</pre>
<div id="attachment_374" class="wp-caption aligncenter" style="width: 184px"><a href="http://zlika.org/wp-content/uploads/2010/04/03.png" rel="lightbox[367]"><img src="http://zlika.org/wp-content/uploads/2010/04/03.png" alt="" title="WHERE filter" width="174" height="115" class="size-full wp-image-374" /></a><p class="wp-caption-text">WHERE filter</p></div>
<p>If we exclude the &#8217;6&#8242; in the HAVING clause, it&#8217;s gonna be filtered after the grouping of the date. The date that has sum of QTY column = 6 will be eliminated and the date May 10, 2009 will miss.</p>
<pre class="brush: sql;">
USE zlika
GO

-- GROUP BY (HAVING filter)
SELECT
	CONVERT(CHAR(10), Date, 103) AS Date
	, SUM(QTY) AS QTY

FROM
	test

GROUP BY
	Date

HAVING
	SUM(QTY) &lt;&gt; 6
GO
</pre>
<div id="attachment_376" class="wp-caption aligncenter" style="width: 179px"><a href="http://zlika.org/wp-content/uploads/2010/04/04.png" rel="lightbox[367]"><img src="http://zlika.org/wp-content/uploads/2010/04/04.png" alt="" title="HAVING filter" width="169" height="92" class="size-full wp-image-376" /></a><p class="wp-caption-text">HAVING filter</p></div>
<p>Clean up the test table.</p>
<pre class="brush: sql;">
USE zlika
GO

-- Clean up
DROP TABLE test
GO
</pre>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="The difference between WHERE and HAVING filters in SQL Server" href="http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/"><b>The difference between WHERE and HAVING filters in SQL Server</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/category/it/sql/" title="View all posts in Transact-SQL" rel="category tag">Transact-SQL</a>, <a href="http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/&title=The difference between WHERE and HAVING filters in SQL Server">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/&t=The difference between WHERE and HAVING filters in SQL Server">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/&title=The difference between WHERE and HAVING filters in SQL Server">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/&title=The difference between WHERE and HAVING filters in SQL Server">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/&title=The difference between WHERE and HAVING filters in SQL Server">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/04/26/the-difference-between-where-and-having-filters-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS SQL Server Cursor Example</title>
		<link>http://zlika.org/index.php/2010/03/06/sql-cursor-example/</link>
		<comments>http://zlika.org/index.php/2010/03/06/sql-cursor-example/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 05:35:09 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=256</guid>
		<description><![CDATA[The cursors in MS SQL Server are not the best way to manipulate the data, because they need more recourse. If you can escape the usage of cursors, do it. OK, the cursors give us a flexible way of manipulating the information. You can imagine a bundle of information, that we use for move through [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Transact-SQL Cursors" href="http://msdn.microsoft.com/en-us/library/ms190028.aspx" target="_blank">The cursors in MS SQL Server</a> are not the best way to manipulate the data, because they need more recourse. If you can escape the usage of cursors, do it. OK, the cursors give us a flexible way of manipulating the information. You can imagine a bundle of information, that we use for move through other information and modify it using the information of our bundle (puting the information in the WHERE clause).</p>
<p><span id="more-256"></span></p>
<p>Let’s say we need to modify a table containing user information. We need to mark those of them, who are registered more than a month (or 30 days) ago. Simultaneously, we need to write in another table only the modified users and the time of modification.</p>
<p>First we create tables, add keys and populate tables.</p>
<pre class="brush: sql;">
USE zlika
GO

-- Create Tables
CREATE TABLE Departments
(
	ID INT NOT NULL
	, DepartmentName VARCHAR(50)
)
GO

CREATE TABLE Person
(
	ID INT IDENTITY
	, FirstName VARCHAR(20)
	, LastName VARCHAR(50)
	, DepartmentID INT
	, RegisteredDate DATETIME
	, CheckStatus BIT
)
GO

CREATE TABLE Checked
(
	PersonID INT
	, CheckDate DATETIME
)
GO

-- Add Keys
ALTER TABLE Departments
ADD CONSTRAINT PK_DepartmentID PRIMARY KEY CLUSTERED
(
	ID ASC
)
GO

ALTER TABLE Person
WITH CHECK ADD CONSTRAINT
FK_Departments_DepartmentID FOREIGN KEY
(
	DepartmentID
)
REFERENCES Departments
(
	ID
)
GO

-- Populate Tables
INSERT INTO Departments (ID, DepartmentName) VALUES
(1, 'IT')
, (2, 'Administration')
, (3, 'Technical Support')
, (4, 'Accounting')
, (5, 'Marketing')
GO

INSERT INTO Person (Firstname, LastName, DepartmentID, RegisteredDate) VALUES
('First', 'Smith', 5, '2010-02-01')
, ('Second', 'Brown', 4, '2010-02-02')
, ('Third', 'Marchal', 3, '2010-02-03')
, ('Fourth', 'Jameson', 2, '2010-02-04')
, ('Fifth', 'Anderson', 1, '2010-02-05')
, ('Sixth', 'Cameron', 1, '2010-02-06')
, ('Seventh', 'Blake', 2, '2010-02-07')
, ('Eight', 'Robert', 3, '2010-02-08')
, ('Ninth', 'Jameson', 4, '2010-02-09')
, ('Tenth', 'Wiliams', 5, '2010-02-10')
GO

-- Preview Tables
SELECT
	*

FROM
	dbo.Person AS P INNER JOIN dbo.Departments AS D
		ON P.DepartmentID = D.ID
GO
</pre>
<div id="attachment_279" class="wp-caption aligncenter" style="width: 658px"><a href="http://zlika.org/wp-content/uploads/2010/03/01.png" rel="lightbox[256]"><img class="size-full wp-image-279" title="Create and populate tables" src="http://zlika.org/wp-content/uploads/2010/03/01.png" alt="" width="648" height="253" /></a><p class="wp-caption-text">Create and populate tables</p></div>
<p>Let&#8217;s say we need to mark only the users of <em>IT</em>, <em>Technical Support</em> and <em>Marketing</em> departments who are registered 28 days ago.</p>
<pre class="brush: sql;">
USE zlika
GO

SELECT
	P.FirstName
	, P.LastName
	, D.DepartmentName
	, CONVERT(CHAR(10), P.RegisteredDate, 103) AS RegisteredDate

FROM
	dbo.Person AS P INNER JOIN dbo.Departments AS D
		ON P.DepartmentID = D.ID
GO
</pre>
<div id="attachment_272" class="wp-caption aligncenter" style="width: 421px"><a href="http://zlika.org/wp-content/uploads/2010/03/02.png" rel="lightbox[256]"><img class="size-full wp-image-272" title="Select all persons" src="http://zlika.org/wp-content/uploads/2010/03/02.png" alt="" width="411" height="254" /></a><p class="wp-caption-text">Select all persons</p></div>
<p>The information that we&#8217;re going to use as filter (in the WHERE clause) is PersonID, RegisteredDate from Person table. That&#8217;s the query that is going to populate the cursor.</p>
<pre class="brush: sql;">
USE zlika
GO

SELECT
	P.ID
	, P.RegisteredDate

FROM
	dbo.Person AS P INNER JOIN dbo.Departments AS D
		ON P.DepartmentID = D.ID

WHERE
	D.DepartmentName IN ('IT', 'Technical Support', 'Marketing')
	AND P.RegisteredDate &lt; DATEDIFF(DAY, 28, GETDATE()) -- 2010-02-06
GO
</pre>
<div id="attachment_285" class="wp-caption aligncenter" style="width: 191px"><a href="http://zlika.org/wp-content/uploads/2010/03/03.png" rel="lightbox[256]"><img class="size-full wp-image-285" title="Populate Cursor Statement" src="http://zlika.org/wp-content/uploads/2010/03/03.png" alt="" width="181" height="111" /></a><p class="wp-caption-text">Populate Cursor Statement</p></div>
<p>The work we need to do is between <em>BEGIN</em> and <em>END</em> keywords. First we mark the status as &#8216;checked&#8217; (1), then we add the PersonID and current date in another table (Checked).</p>
<pre class="brush: sql;">
USE zlika
GO

-- Execute the UPDATE Statement
UPDATE Person
SET CheckStatus = 1
WHERE ID IN (1, 3, 5)

-- Execute the INSERT Statement
INSERT INTO Checked (PersonID, CheckDate) VALUES
(1, GETDATE())
, (3, GETDATE())
, (5, GETDATE())
</pre>
<p>OK, here&#8217;s the guy who do the real work &#8211; the cursor itself. We store the content of the cursor in a variables and we execute the two steps for every row of it. The variables are our filters &#8211; we use them in the WHERE clause.</p>
<pre class="brush: sql;">
USE zlika
GO

-- Declare the variables
DECLARE @PersonID INT
DECLARE @Date DATETIME = DATEDIFF(DAY, 28, GETDATE())

-- Declare the cursor
DECLARE Update_Person_Cursor CURSOR FOR

-- Populate the cursor
SELECT
	P.ID
	, P.RegisteredDate

FROM
	dbo.Person AS P INNER JOIN dbo.Departments AS D
		ON P.DepartmentID = D.ID

WHERE
	D.DepartmentName IN ('IT', 'Technical Support', 'Marketing')
	AND P.RegisteredDate &lt; @Date
	AND P.CheckStatus IS NULL

-- Open the cursor to work with it
OPEN Update_Person_Cursor

-- Select The first row into the variables (@PesronID = 1, @Date = 2010-02-01)
FETCH NEXT FROM Update_Person_Cursor INTO
	@PersonID
	, @Date

-- While there are no more rows in the cursor...
WHILE @@FETCH_STATUS = 0

-- Do the two steps!
BEGIN
	-- Execute the UPDATE statement
	UPDATE Person
	SET CheckStatus = 1
	WHERE ID = @PersonID

	-- Execute the INSERT statement
	INSERT INTO Checked (PersonID, CheckDate) VALUES
	(@PersonID, GETDATE())

	-- Select The second row into the variables (@PesronID = 3, @Date = 2010-02-03)
	FETCH NEXT FROM Update_Person_Cursor INTO
		@PersonID
		, @Date
END

-- Close The cursor
CLOSE Update_Person_Cursor

-- Kill the cursor
DEALLOCATE Update_Person_Cursor
GO
</pre>
<p>The records in the &#8216;Checked&#8217; table are those we needed.</p>
<pre class="brush: sql;">
USE zlika
GO

SELECT * FROM Checked
</pre>
<div id="attachment_292" class="wp-caption aligncenter" style="width: 295px"><a href="http://zlika.org/wp-content/uploads/2010/03/04.png" rel="lightbox[256]"><img class="size-full wp-image-292" title="Content of 'Checked' table" src="http://zlika.org/wp-content/uploads/2010/03/04.png" alt="" width="285" height="110" /></a><p class="wp-caption-text">Content of &#39;Checked&#39; table</p></div>
<p>&#8230;and the status in the &#8216;Person&#8217; table is changed to &#8217;1&#8242;.</p>
<pre class="brush: sql;">
USE zlika
GO

SELECT
	*

FROM
	dbo.Person AS P INNER JOIN dbo.Departments AS D
		ON P.DepartmentID = D.ID
GO
</pre>
<div id="attachment_296" class="wp-caption aligncenter" style="width: 657px"><a href="http://zlika.org/wp-content/uploads/2010/03/05.png" rel="lightbox[256]"><img class="size-full wp-image-296" title="The content of 'Person' table" src="http://zlika.org/wp-content/uploads/2010/03/05.png" alt="" width="647" height="252" /></a><p class="wp-caption-text">The content of &#39;Person&#39; table</p></div>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="MS SQL Server Cursor Example" href="http://zlika.org/index.php/2010/03/06/sql-cursor-example/"><b>MS SQL Server Cursor Example</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/2010/03/06/sql-cursor-example/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/03/06/sql-cursor-example/&title=MS SQL Server Cursor Example">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/03/06/sql-cursor-example/&t=MS SQL Server Cursor Example">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/03/06/sql-cursor-example/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/03/06/sql-cursor-example/&title=MS SQL Server Cursor Example">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/03/06/sql-cursor-example/&title=MS SQL Server Cursor Example">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/03/06/sql-cursor-example/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/03/06/sql-cursor-example/&title=MS SQL Server Cursor Example">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/03/06/sql-cursor-example/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/03/06/sql-cursor-example/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/03/06/sql-cursor-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Join Tables in MS SQL &#8211; FROM or WHERE clause?</title>
		<link>http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/</link>
		<comments>http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 02:16:12 +0000</pubDate>
		<dc:creator>zlika</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://zlika.org/?p=171</guid>
		<description><![CDATA[I was interested of the different SQL &#8220;accents&#8221;. According to Microsoft SQL Server learning books, we query like this:

SELECT
 *

FROM
 table1 INNER JOIN table2
  ON table1.PK = table2.FK
GO


The MySQL guys makes queries like this:

SELECT *
FROM table1, table2
WHERE table1.PK = table2.FK;

Using Microsoft SQL Server 2008, I wrote a script to create and populate two tables [...]]]></description>
			<content:encoded><![CDATA[<p>I was interested of the different SQL &#8220;accents&#8221;. According to Microsoft SQL Server learning books, we query like this:</p>
<pre class="brush: sql;">
SELECT
 *

FROM
 table1 INNER JOIN table2
  ON table1.PK = table2.FK
GO
</pre>
<p><span id="more-171"></span></p>
<p>The MySQL guys makes queries like this:</p>
<pre class="brush: sql;">
SELECT *
FROM table1, table2
WHERE table1.PK = table2.FK;
</pre>
<p>Using Microsoft SQL Server 2008, I wrote a script to create and populate two tables (the model data is found somewhere in internet).</p>
<pre class="brush: sql; collapse: true; light: false; toolbar: true;">
IF EXISTS (
SELECT 1
 FROM sys.objects
 WHERE OBJECT_ID = OBJECT_ID(N'City')
 AND type = (N'U')
)
DROP TABLE City
GO

IF EXISTS (
 SELECT 1
 FROM sys.objects
 WHERE OBJECT_ID = OBJECT_ID(N'Country')
 AND type = (N'U')
)
DROP TABLE Country
GO

CREATE TABLE Country (
 CountryID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY CLUSTERED
 , CountryName VARCHAR(50) NOT NULL
)
GO

CREATE TABLE City (
 CityID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY CLUSTERED
 , CityName VARCHAR(50) NOT NULL
 , CountryID INT NOT NULL REFERENCES Country(CountryID)
)
GO

INSERT INTO Country (CountryName) VALUES
('Afghanistan')
, ('Algeria')
, ('American Samoa')
, ('Angola')
, ('Anguilla')
, ('Argentina')
, ('Armenia')
, ('Australia')
, ('Austria')
, ('Azerbaijan')
, ('Bahrain')
, ('Bangladesh')
, ('Belarus')
, ('Bolivia')
, ('Brazil')
, ('Brunei')
, ('Bulgaria')
, ('Cambodia')
, ('Cameroon')
, ('Canada')
, ('Chad')
, ('Chile')
, ('China')
, ('Colombia')
, ('Congo, The Democratic Republic of the')
, ('Czech Republic')
, ('Dominican Republic')
, ('Ecuador')
, ('Egypt')
, ('Estonia')
, ('Ethiopia')
, ('Faroe Islands')
, ('Finland')
, ('France')
, ('French Guiana')
, ('French Polynesia')
, ('Gambia')
, ('Germany')
, ('Greece')
, ('Greenland')
, ('Holy See (Vatican City State)')
, ('Hong Kong')
, ('Hungary')
, ('India')
, ('Indonesia')
, ('Iran')
, ('Iraq')
, ('Israel')
, ('Italy')
, ('Japan')
, ('Kazakstan')
, ('Kenya')
, ('Kuwait')
, ('Latvia')
, ('Liechtenstein')
, ('Lithuania')
, ('Madagascar')
, ('Malawi')
, ('Malaysia')
, ('Mexico')
, ('Moldova')
, ('Morocco')
, ('Mozambique')
, ('Myanmar')
, ('Nauru')
, ('Nepal')
, ('Netherlands')
, ('New Zealand')
, ('Nigeria')
, ('North Korea')
, ('Oman')
, ('Pakistan')
, ('Paraguay')
, ('Peru')
, ('Philippines')
, ('Poland')
, ('Puerto Rico')
, ('Romania')
, ('Runion')
, ('Russian Federation')
, ('Saint Vincent and the Grenadines')
, ('Saudi Arabia')
, ('Senegal')
, ('Slovakia')
, ('South Africa')
, ('South Korea')
, ('Spain')
, ('Sri Lanka')
, ('Sudan')
, ('Sweden')
, ('Switzerland')
, ('Taiwan')
, ('Tanzania')
, ('Thailand')
, ('Tonga')
, ('Tunisia')
, ('Turkey')
, ('Turkmenistan')
, ('Tuvalu')
, ('Ukraine')
, ('United Arab Emirates')
, ('United Kingdom')
, ('United States')
, ('Venezuela')
, ('Vietnam')
, ('Virgin Islands, U.S.')
, ('Yemen')
, ('Yugoslavia')
, ('Zambia')
GO

INSERT INTO City (CityName, CountryID) VALUES
('A Corua (La Corua)', 87)
, ('Abha', 82)
, ('Abu Dhabi', 101)
, ('Acua', 60)
, ('Adana', 97)
, ('Addis Abeba', 31)
, ('Aden', 107)
, ('Adoni', 44)
, ('Ahmadnagar', 44)
, ('Akishima', 50)
, ('Akron', 103)
, ('al-Ayn', 101)
, ('al-Hawiya', 82)
, ('al-Manama', 11)
, ('al-Qadarif', 89)
, ('al-Qatif', 82)
, ('Alessandria', 49)
, ('Allappuzha (Alleppey)', 44)
, ('Allende', 60)
, ('Almirante Brown', 6)
, ('Alvorada', 15)
, ('Ambattur', 44)
, ('Amersfoort', 67)
, ('Amroha', 44)
, ('Angra dos Reis', 15)
, ('Anpolis', 15)
, ('Antofagasta', 22)
, ('Aparecida de Goinia', 15)
, ('Apeldoorn', 67)
, ('Araatuba', 15)
, ('Arak', 46)
, ('Arecibo', 77)
, ('Arlington', 103)
, ('Ashdod', 48)
, ('Ashgabat', 98)
, ('Ashqelon', 48)
, ('Asuncin', 73)
, ('Athenai', 39)
, ('Atinsk', 80)
, ('Atlixco', 60)
, ('Augusta-Richmond County', 103)
, ('Aurora', 103)
, ('Avellaneda', 6)
, ('Bag', 15)
, ('Baha Blanca', 6)
, ('Baicheng', 23)
, ('Baiyin', 23)
, ('Baku', 10)
, ('Balaiha', 80)
, ('Balikesir', 97)
, ('Balurghat', 44)
, ('Bamenda', 19)
, ('Bandar Seri Begawan', 16)
, ('Banjul', 37)
, ('Barcelona', 104)
, ('Basel', 91)
, ('Bat Yam', 48)
, ('Batman', 97)
, ('Batna', 2)
, ('Battambang', 18)
, ('Baybay', 75)
, ('Bayugan', 75)
, ('Bchar', 2)
, ('Beira', 63)
, ('Bellevue', 103)
, ('Belm', 15)
, ('Benguela', 4)
, ('Beni-Mellal', 62)
, ('Benin City', 69)
, ('Bergamo', 49)
, ('Berhampore (Baharampur)', 44)
, ('Bern', 91)
, ('Bhavnagar', 44)
, ('Bhilwara', 44)
, ('Bhimavaram', 44)
, ('Bhopal', 44)
, ('Bhusawal', 44)
, ('Bijapur', 44)
, ('Bilbays', 29)
, ('Binzhou', 23)
, ('Birgunj', 66)
, ('Bislig', 75)
, ('Blumenau', 15)
, ('Boa Vista', 15)
, ('Boksburg', 85)
, ('Botosani', 78)
, ('Botshabelo', 85)
, ('Bradford', 102)
, ('Braslia', 15)
, ('Bratislava', 84)
, ('Brescia', 49)
, ('Brest', 34)
, ('Brindisi', 49)
, ('Brockton', 103)
, ('Bucuresti', 78)
, ('Buenaventura', 24)
, ('Bydgoszcz', 76)
, ('Cabuyao', 75)
, ('Callao', 74)
, ('Cam Ranh', 105)
, ('Cape Coral', 103)
, ('Caracas', 104)
, ('Carmen', 60)
, ('Cavite', 75)
, ('Cayenne', 35)
, ('Celaya', 60)
, ('Chandrapur', 44)
, ('Changhwa', 92)
, ('Changzhou', 23)
, ('Chapra', 44)
, ('Charlotte Amalie', 106)
, ('Chatsworth', 85)
, ('Cheju', 86)
, ('Chiayi', 92)
, ('Chisinau', 61)
, ('Chungho', 92)
, ('Cianjur', 45)
, ('Ciomas', 45)
, ('Ciparay', 45)
, ('Citrus Heights', 103)
, ('Citt del Vaticano', 41)
, ('Ciudad del Este', 73)
, ('Clarksville', 103)
, ('Coacalco de Berriozbal', 60)
, ('Coatzacoalcos', 60)
, ('Compton', 103)
, ('Coquimbo', 22)
, ('Crdoba', 6)
, ('Cuauhtmoc', 60)
, ('Cuautla', 60)
, ('Cuernavaca', 60)
, ('Cuman', 104)
, ('Czestochowa', 76)
, ('Dadu', 72)
, ('Dallas', 103)
, ('Datong', 23)
, ('Daugavpils', 54)
, ('Davao', 75)
, ('Daxian', 23)
, ('Dayton', 103)
, ('Deba Habe', 69)
, ('Denizli', 97)
, ('Dhaka', 12)
, ('Dhule (Dhulia)', 44)
, ('Dongying', 23)
, ('Donostia-San Sebastin', 87)
, ('Dos Quebradas', 24)
, ('Duisburg', 38)
, ('Dundee', 102)
, ('Dzerzinsk', 80)
, ('Ede', 67)
, ('Effon-Alaiye', 69)
, ('El Alto', 14)
, ('El Fuerte', 60)
, ('El Monte', 103)
, ('Elista', 80)
, ('Emeishan', 23)
, ('Emmen', 67)
, ('Enshi', 23)
, ('Erlangen', 38)
, ('Escobar', 6)
, ('Esfahan', 46)
, ('Eskisehir', 97)
, ('Etawah', 44)
, ('Ezeiza', 6)
, ('Ezhou', 23)
, ('Faaa', 36)
, ('Fengshan', 92)
, ('Firozabad', 44)
, ('Florencia', 24)
, ('Fontana', 103)
, ('Fukuyama', 50)
, ('Funafuti', 99)
, ('Fuyu', 23)
, ('Fuzhou', 23)
, ('Gandhinagar', 44)
, ('Garden Grove', 103)
, ('Garland', 103)
, ('Gatineau', 20)
, ('Gaziantep', 97)
, ('Gijn', 87)
, ('Gingoog', 75)
, ('Goinia', 15)
, ('Gorontalo', 45)
, ('Grand Prairie', 103)
, ('Graz', 9)
, ('Greensboro', 103)
, ('Guadalajara', 60)
, ('Guaruj', 15)
, ('guas Lindas de Gois', 15)
, ('Gulbarga', 44)
, ('Hagonoy', 75)
, ('Haining', 23)
, ('Haiphong', 105)
, ('Haldia', 44)
, ('Halifax', 20)
, ('Halisahar', 44)
, ('Halle/Saale', 38)
, ('Hami', 23)
, ('Hamilton', 68)
, ('Hanoi', 105)
, ('Hidalgo', 60)
, ('Higashiosaka', 50)
, ('Hino', 50)
, ('Hiroshima', 50)
, ('Hodeida', 107)
, ('Hohhot', 23)
, ('Hoshiarpur', 44)
, ('Hsichuh', 92)
, ('Huaian', 23)
, ('Hubli-Dharwad', 44)
, ('Huejutla de Reyes', 60)
, ('Huixquilucan', 60)
, ('Hunuco', 74)
, ('Ibirit', 15)
, ('Idfu', 29)
, ('Ife', 69)
, ('Ikerre', 69)
, ('Iligan', 75)
, ('Ilorin', 69)
, ('Imus', 75)
, ('Inegl', 97)
, ('Ipoh', 59)
, ('Isesaki', 50)
, ('Ivanovo', 80)
, ('Iwaki', 50)
, ('Iwakuni', 50)
, ('Iwatsuki', 50)
, ('Izumisano', 50)
, ('Jaffna', 88)
, ('Jaipur', 44)
, ('Jakarta', 45)
, ('Jalib al-Shuyukh', 53)
, ('Jamalpur', 12)
, ('Jaroslavl', 80)
, ('Jastrzebie-Zdrj', 76)
, ('Jedda', 82)
, ('Jelets', 80)
, ('Jhansi', 44)
, ('Jinchang', 23)
, ('Jining', 23)
, ('Jinzhou', 23)
, ('Jodhpur', 44)
, ('Johannesburg', 85)
, ('Joliet', 103)
, ('Jos Azueta', 60)
, ('Juazeiro do Norte', 15)
, ('Juiz de Fora', 15)
, ('Junan', 23)
, ('Jurez', 60)
, ('Kabul', 1)
, ('Kaduna', 69)
, ('Kakamigahara', 50)
, ('Kaliningrad', 80)
, ('Kalisz', 76)
, ('Kamakura', 50)
, ('Kamarhati', 44)
, ('Kamjanets-Podilskyi', 100)
, ('Kamyin', 80)
, ('Kanazawa', 50)
, ('Kanchrapara', 44)
, ('Kansas City', 103)
, ('Karnal', 44)
, ('Katihar', 44)
, ('Kermanshah', 46)
, ('Kilis', 97)
, ('Kimberley', 85)
, ('Kimchon', 86)
, ('Kingstown', 81)
, ('Kirovo-Tepetsk', 80)
, ('Kisumu', 52)
, ('Kitwe', 109)
, ('Klerksdorp', 85)
, ('Kolpino', 80)
, ('Konotop', 100)
, ('Koriyama', 50)
, ('Korla', 23)
, ('Korolev', 80)
, ('Kowloon and New Kowloon', 42)
, ('Kragujevac', 108)
, ('Ktahya', 97)
, ('Kuching', 59)
, ('Kumbakonam', 44)
, ('Kurashiki', 50)
, ('Kurgan', 80)
, ('Kursk', 80)
, ('Kuwana', 50)
, ('La Paz', 60)
, ('La Plata', 6)
, ('La Romana', 27)
, ('Laiwu', 23)
, ('Lancaster', 103)
, ('Laohekou', 23)
, ('Lapu-Lapu', 75)
, ('Laredo', 103)
, ('Lausanne', 91)
, ('Le Mans', 34)
, ('Lengshuijiang', 23)
, ('Leshan', 23)
, ('Lethbridge', 20)
, ('Lhokseumawe', 45)
, ('Liaocheng', 23)
, ('Liepaja', 54)
, ('Lilongwe', 58)
, ('Lima', 74)
, ('Lincoln', 103)
, ('Linz', 9)
, ('Lipetsk', 80)
, ('Livorno', 49)
, ('Ljubertsy', 80)
, ('Loja', 28)
, ('London', 102)
, ('London', 20)
, ('Lublin', 76)
, ('Lubumbashi', 25)
, ('Lungtan', 92)
, ('Luzinia', 15)
, ('Madiun', 45)
, ('Mahajanga', 57)
, ('Maikop', 80)
, ('Malm', 90)
, ('Manchester', 103)
, ('Mandaluyong', 75)
, ('Mandi Bahauddin', 72)
, ('Mannheim', 38)
, ('Maracabo', 104)
, ('Mardan', 72)
, ('Maring', 15)
, ('Masqat', 71)
, ('Matamoros', 60)
, ('Matsue', 50)
, ('Meixian', 23)
, ('Memphis', 103)
, ('Merlo', 6)
, ('Mexicali', 60)
, ('Miraj', 44)
, ('Mit Ghamr', 29)
, ('Miyakonojo', 50)
, ('Mogiljov', 13)
, ('Molodetno', 13)
, ('Monclova', 60)
, ('Monywa', 64)
, ('Moscow', 80)
, ('Mosul', 47)
, ('Mukateve', 100)
, ('Munger (Monghyr)', 44)
, ('Mwanza', 93)
, ('Mwene-Ditu', 25)
, ('Myingyan', 64)
, ('Mysore', 44)
, ('Naala-Porto', 63)
, ('Nabereznyje Telny', 80)
, ('Nador', 62)
, ('Nagaon', 44)
, ('Nagareyama', 50)
, ('Najafabad', 46)
, ('Naju', 86)
, ('Nakhon Sawan', 94)
, ('Nam Dinh', 105)
, ('Namibe', 4)
, ('Nantou', 92)
, ('Nanyang', 23)
, ('NDjamna', 21)
, ('Newcastle', 85)
, ('Nezahualcyotl', 60)
, ('Nha Trang', 105)
, ('Niznekamsk', 80)
, ('Novi Sad', 108)
, ('Novoterkassk', 80)
, ('Nukualofa', 95)
, ('Nuuk', 40)
, ('Nyeri', 52)
, ('Ocumare del Tuy', 104)
, ('Ogbomosho', 69)
, ('Okara', 72)
, ('Okayama', 50)
, ('Okinawa', 50)
, ('Olomouc', 26)
, ('Omdurman', 89)
, ('Omiya', 50)
, ('Ondo', 69)
, ('Onomichi', 50)
, ('Oshawa', 20)
, ('Osmaniye', 97)
, ('ostka', 100)
, ('Otsu', 50)
, ('Oulu', 33)
, ('Ourense (Orense)', 87)
, ('Owo', 69)
, ('Oyo', 69)
, ('Ozamis', 75)
, ('Paarl', 85)
, ('Pachuca de Soto', 60)
, ('Pak Kret', 94)
, ('Palghat (Palakkad)', 44)
, ('Pangkal Pinang', 45)
, ('Papeete', 36)
, ('Parbhani', 44)
, ('Pathankot', 44)
, ('Patiala', 44)
, ('Patras', 39)
, ('Pavlodar', 51)
, ('Pemalang', 45)
, ('Peoria', 103)
, ('Pereira', 24)
, ('Phnom Penh', 18)
, ('Pingxiang', 23)
, ('Pjatigorsk', 80)
, ('Plock', 76)
, ('Po', 15)
, ('Ponce', 77)
, ('Pontianak', 45)
, ('Poos de Caldas', 15)
, ('Portoviejo', 28)
, ('Probolinggo', 45)
, ('Pudukkottai', 44)
, ('Pune', 44)
, ('Purnea (Purnia)', 44)
, ('Purwakarta', 45)
, ('Pyongyang', 70)
, ('Qalyub', 29)
, ('Qinhuangdao', 23)
, ('Qomsheh', 46)
, ('Quilmes', 6)
, ('Rae Bareli', 44)
, ('Rajkot', 44)
, ('Rampur', 44)
, ('Rancagua', 22)
, ('Ranchi', 44)
, ('Richmond Hill', 20)
, ('Rio Claro', 15)
, ('Rizhao', 23)
, ('Roanoke', 103)
, ('Robamba', 28)
, ('Rockford', 103)
, ('Ruse', 17)
, ('Rustenburg', 85)
, ('s-Hertogenbosch', 67)
, ('Saarbrcken', 38)
, ('Sagamihara', 50)
, ('Saint Louis', 103)
, ('Saint-Denis', 79)
, ('Sal', 62)
, ('Salala', 71)
, ('Salamanca', 60)
, ('Salinas', 103)
, ('Salzburg', 9)
, ('Sambhal', 44)
, ('San Bernardino', 103)
, ('San Felipe de Puerto Plata', 27)
, ('San Felipe del Progreso', 60)
, ('San Juan Bautista Tuxtepec', 60)
, ('San Lorenzo', 73)
, ('San Miguel de Tucumn', 6)
, ('Sanaa', 107)
, ('Santa Brbara dOeste', 15)
, ('Santa F', 6)
, ('Santa Rosa', 75)
, ('Santiago de Compostela', 87)
, ('Santiago de los Caballeros', 27)
, ('Santo Andr', 15)
, ('Sanya', 23)
, ('Sasebo', 50)
, ('Satna', 44)
, ('Sawhaj', 29)
, ('Serpuhov', 80)
, ('Shahr-e Kord', 46)
, ('Shanwei', 23)
, ('Shaoguan', 23)
, ('Sharja', 101)
, ('Shenzhen', 23)
, ('Shikarpur', 72)
, ('Shimoga', 44)
, ('Shimonoseki', 50)
, ('Shivapuri', 44)
, ('Shubra al-Khayma', 29)
, ('Siegen', 38)
, ('Siliguri (Shiliguri)', 44)
, ('Simferopol', 100)
, ('Sincelejo', 24)
, ('Sirjan', 46)
, ('Sivas', 97)
, ('Skikda', 2)
, ('Smolensk', 80)
, ('So Bernardo do Campo', 15)
, ('So Leopoldo', 15)
, ('Sogamoso', 24)
, ('Sokoto', 69)
, ('Songkhla', 94)
, ('Sorocaba', 15)
, ('Soshanguve', 85)
, ('Sousse', 96)
, ('South Hill', 5)
, ('Southampton', 102)
, ('Southend-on-Sea', 102)
, ('Southport', 102)
, ('Springs', 85)
, ('Stara Zagora', 17)
, ('Sterling Heights', 103)
, ('Stockport', 102)
, ('Sucre', 14)
, ('Suihua', 23)
, ('Sullana', 74)
, ('Sultanbeyli', 97)
, ('Sumqayit', 10)
, ('Sumy', 100)
, ('Sungai Petani', 59)
, ('Sunnyvale', 103)
, ('Surakarta', 45)
, ('Syktyvkar', 80)
, ('Syrakusa', 49)
, ('Szkesfehrvr', 43)
, ('Tabora', 93)
, ('Tabriz', 46)
, ('Tabuk', 82)
, ('Tafuna', 3)
, ('Taguig', 75)
, ('Taizz', 107)
, ('Talavera', 75)
, ('Tallahassee', 103)
, ('Tama', 50)
, ('Tambaram', 44)
, ('Tanauan', 75)
, ('Tandil', 6)
, ('Tangail', 12)
, ('Tanshui', 92)
, ('Tanza', 75)
, ('Tarlac', 75)
, ('Tarsus', 97)
, ('Tartu', 30)
, ('Teboksary', 80)
, ('Tegal', 45)
, ('Tel Aviv-Jaffa', 48)
, ('Tete', 63)
, ('Tianjin', 23)
, ('Tiefa', 23)
, ('Tieli', 23)
, ('Tokat', 97)
, ('Tonghae', 86)
, ('Tongliao', 23)
, ('Torren', 60)
, ('Touliu', 92)
, ('Toulon', 34)
, ('Toulouse', 34)
, ('Trshavn', 32)
, ('Tsaotun', 92)
, ('Tsuyama', 50)
, ('Tuguegarao', 75)
, ('Tychy', 76)
, ('Udaipur', 44)
, ('Udine', 49)
, ('Ueda', 50)
, ('Uijongbu', 86)
, ('Uluberia', 44)
, ('Urawa', 50)
, ('Uruapan', 60)
, ('Usak', 97)
, ('Usolje-Sibirskoje', 80)
, ('Uttarpara-Kotrung', 44)
, ('Vaduz', 55)
, ('Valencia', 104)
, ('Valle de la Pascua', 104)
, ('Valle de Santiago', 60)
, ('Valparai', 44)
, ('Vancouver', 20)
, ('Varanasi (Benares)', 44)
, ('Vicente Lpez', 6)
, ('Vijayawada', 44)
, ('Vila Velha', 15)
, ('Vilnius', 56)
, ('Vinh', 105)
, ('Vitria de Santo Anto', 15)
, ('Warren', 103)
, ('Weifang', 23)
, ('Witten', 38)
, ('Woodridge', 8)
, ('Wroclaw', 76)
, ('Xiangfan', 23)
, ('Xiangtan', 23)
, ('Xintai', 23)
, ('Xinxiang', 23)
, ('Yamuna Nagar', 44)
, ('Yangor', 65)
, ('Yantai', 23)
, ('Yaound', 19)
, ('Yerevan', 7)
, ('Yinchuan', 23)
, ('Yingkou', 23)
, ('York', 102)
, ('Yuncheng', 23)
, ('Yuzhou', 23)
, ('Zalantun', 23)
, ('Zanzibar', 93)
, ('Zaoyang', 23)
, ('Zapopan', 60)
, ('Zaria', 69)
, ('Zeleznogorsk', 80)
, ('Zhezqazghan', 51)
, ('Zhoushan', 23)
, ('Ziguinchor', 83)
GO
</pre>
<p>Then I wrote two queries to examine the data in both ways.</p>
<pre class="brush: sql; highlight: [7,16];">
-- FROM
SELECT
	*

FROM
	City AS ci INNER JOIN Country AS co
		ON ci.CountryID = co.CountryID

WHERE
	co.CountryID IN (44, 23, 103, 50, 60)
GO

-- WHERE
SELECT *
FROM City ci, Country co
WHERE ci.CountryID = co.CountryID
  AND co.CountryID IN (44, 23, 103, 50, 60)
GO
</pre>
<p>I asked an IT guy today &#8220;You write your queries in Oracle by using which manner?&#8221; and he answered me that he joins the tables in the WHERE clause. The execution plan told me there&#8217;s no difference in the execution.</p>
<p><a href="http://zlika.org/wp-content/uploads/2010/01/from_where.jpg" rel="lightbox[171]"><img title="FROM or WHERE clause?" src="http://zlika.org/wp-content/uploads/2010/01/from_where.jpg" alt="Full size" width="638" height="374" /></a></p>
<p>As a Microsoft fan, I prefer to link the tables using the FROM clause, because I may have no need of WHERE clause :-)</p>
<p>Félicitations</p>
<hr size="1" noshade>
<p style="font-family = verdana, tahoma, arial, sans-serif; font-size: 10px;">
<a title="Join Tables in MS SQL &#8211; FROM or WHERE clause?" href="http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/"><b>Join Tables in MS SQL &#8211; FROM or WHERE clause?</b></a> <br />
Author: zlika (Peter Lalovsky), Category: <a href="http://zlika.org/index.php/category/it/" title="View all posts in IT" rel="category tag">IT</a>, <a href="http://zlika.org/index.php/category/it/ms-sql-server/" title="View all posts in MS SQL Server" rel="category tag">MS SQL Server</a>, <a href="http://zlika.org/index.php/category/it/mysql/" title="View all posts in MySQL" rel="category tag">MySQL</a>, <a href="http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/#comments">%%comment_text%%</a>

<br />

Add to:
<a title="Share on Delicious" href="http://del.icio.us/post?url=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/&title=Join Tables in MS SQL &#8211; FROM or WHERE clause?">Delicious</a> | 
<a title="Share on Facebook" href="http://www.facebook.com/sharer.php?u=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/&t=Join Tables in MS SQL &#8211; FROM or WHERE clause?">Facebook</a> | 
<a title="Share on Twitter" href="http://twitter.com/home?status=Currently reading http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/">Twitter</a> | <a title="Share on Live" href="http://favorites.live.com/quickadd.aspx?url=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/&title=Join Tables in MS SQL &#8211; FROM or WHERE clause?">Live</a> | 
<a title="Share on Reddit" href="http://reddit.com/submit?url=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/&title=Join Tables in MS SQL &#8211; FROM or WHERE clause?">Reddit</a> | 
<a title="Share on Technorati" href="http://www.technorati.com/faves?add=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/">Technorati</a> | 
<a title="Share on Digg" href="http://digg.com/submit?url=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/&title=Join Tables in MS SQL &#8211; FROM or WHERE clause?">Digg</a>

<br />

Followers: <a href="http://www.technorati.com/search/http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/" title="Linking blogs to this article, on Technorati">Technorati</a> | <a href="http://www.google.com/blogsearch?hl=en&q=http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/" title="Linking blogs to this article, on Google">Google</a>

<br />

© 2010, <a href="http://zlika.org">zlika&#039;s</a> (<a href="http://zlika.org/index.php/feed/">RSS</a>)
</p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://zlika.org/index.php/2010/01/21/linking-tables-in-sql-from-of-where-clause/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

