<?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>get the table difference &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/get-the-table-difference/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 30 Apr 2018 13:43:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: Do the Schema Compare between two Tables</title>
		<link>https://www.dbrnd.com/2018/05/sql-server-do-the-schema-compare-between-two-tables/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 11 May 2018 16:16:55 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[get the table difference]]></category>
		<category><![CDATA[schema compare]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7554</guid>

					<description><![CDATA[For a database developer, comparing the table data and schema is a very common task. I already shared few versions of it. Most of the time, developers are comparing schemas between Production Server and Development Server. In this post, I am sharing a script to compare the table schema using dm_exec_describe_first_result_set. SQL Server: How to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&amp;linkname=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&amp;linkname=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&amp;linkname=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&amp;linkname=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&amp;linkname=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&amp;linkname=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-do-the-schema-compare-between-two-tables%2F&#038;title=SQL%20Server%3A%20Do%20the%20Schema%20Compare%20between%20two%20Tables" data-a2a-url="https://www.dbrnd.com/2018/05/sql-server-do-the-schema-compare-between-two-tables/" data-a2a-title="SQL Server: Do the Schema Compare between two Tables"></a></p><p>For a database developer, comparing the table data and schema is a very common task. I already shared few versions of it.<br />
Most of the time, developers are comparing schemas between Production Server and Development Server.</p>
<p>In this post, I am sharing a script to compare the table schema using dm_exec_describe_first_result_set.</p>
<blockquote class="wp-embedded-content" data-secret="CaGb5Rk14M"><p><a href="https://www.dbrnd.com/2018/01/sql-server-how-to-get-the-table-column-differences/">SQL Server: How to get the Table Column Differences?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2018/01/sql-server-how-to-get-the-table-column-differences/embed/#?secret=CaGb5Rk14M" data-secret="CaGb5Rk14M" width="600" height="338" title="&#8220;SQL Server: How to get the Table Column Differences?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="FNK55CgqzK"><p><a href="https://www.dbrnd.com/2018/01/sql-server-easy-way-to-get-the-table-difference/">SQL Server: Easy way to get the Table Difference For Data</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2018/01/sql-server-easy-way-to-get-the-table-difference/embed/#?secret=FNK55CgqzK" data-secret="FNK55CgqzK" width="600" height="338" title="&#8220;SQL Server: Easy way to get the Table Difference For Data&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Create sample tables:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_A (ID INT, Name VARCHAR(100), Sub CHAR(5))
CREATE TABLE tbl_B (ID INT, Name VARCHAR(20), Sub VARCHAR(5), Grade INT)</pre><p>
<strong>Get the schema differences:</strong></p><pre class="crayon-plain-tag">SELECT 
	tbl_A.name as tbl_A_ColumnName
	,tbl_B.name as tbl_B_ColumnName
	,tbl_A.system_type_name as tbl_A_Datatype
	,tbl_B.system_type_name as tbl_B_Datatype 
	,tbl_A.is_identity_column as tbl_A_is_identity
	,tbl_B.is_identity_column as tbl_B_is_identity  
	,tbl_A.is_nullable as tbl_A_is_nullable
	,tbl_B.is_nullable as tbl_B_is_nullable
FROM sys.dm_exec_describe_first_result_set (N'SELECT * FROM tbl_A', NULL, 0) tbl_A 
FULL OUTER JOIN  sys.dm_exec_describe_first_result_set (N'SELECT * FROM tbl_B', NULL, 0) tbl_B 
ON tbl_A.name = tbl_B.name 
GO</pre><p>
<strong>Result:</strong></p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-7557" src="https://www.dbrnd.com/wp-content/uploads/2018/04/SQL-Server-Compare-Table.png" alt="SQL Server Compare Table" width="1007" height="122" srcset="https://www.dbrnd.com/wp-content/uploads/2018/04/SQL-Server-Compare-Table.png 1007w, https://www.dbrnd.com/wp-content/uploads/2018/04/SQL-Server-Compare-Table-850x103.png 850w, https://www.dbrnd.com/wp-content/uploads/2018/04/SQL-Server-Compare-Table-679x82.png 679w" sizes="(max-width: 1007px) 100vw, 1007px" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
