<?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>Wizz's Coding Solutions &#187; SQL Server</title>
	<atom:link href="http://rainstorms.me.uk/blog/tag/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://rainstorms.me.uk/blog</link>
	<description>Problems that I come across in day to day coding</description>
	<lastBuildDate>Thu, 07 Jul 2011 07:50:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Finding missing foreign keys in Transact SQL (for MS SQL Server)</title>
		<link>http://rainstorms.me.uk/blog/2010/05/25/finding-missing-foreign-keys-in-transact-sql-for-ms-sql-server/</link>
		<comments>http://rainstorms.me.uk/blog/2010/05/25/finding-missing-foreign-keys-in-transact-sql-for-ms-sql-server/#comments</comments>
		<pubDate>Tue, 25 May 2010 15:35:15 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[foreign key]]></category>
		<category><![CDATA[ID]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transact SQl]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=292</guid>
		<description><![CDATA[When I put together a database, I generally use integer ID fields to reference one table from another and I usually have the referencing field ending in &#8220;ID&#8221;.  e.g if I have Customer and Order tables, Order will have a CustomerID field. The problem is that in a big database, it is easy to forget [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>When I put together a database, I generally use integer ID fields to reference one table from another and I usually have the referencing field ending in &#8220;ID&#8221;.  e.g if I have Customer and Order tables, Order will have a CustomerID field.</p>
<p>The problem is that in a big database, it is easy to forget to enforce the foreign key constraints for each and every one, so I thought it would be useful to have a query to find them.  After a bit of playing about, I have ended up with&#8230;</p>
<pre name="code" class="sql">

select table_name,COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS cols where COLUMN_NAME <>'ID' and COLUMN_NAME like '%ID'
and TABLE_NAME not in('dtproperties')
and (select COUNT(*) from INFORMATION_SCHEMA.KEY_COLUMN_USAGE keys where keys.TABLE_NAME=cols.TABLE_NAME and keys.COLUMN_NAME=cols.COLUMN_NAME)=0
order by TABLE_NAME
</pre>
<p>You can add in extra tables to exclude in the &#8220;TABLE_NAME not in&#8221; clause.  I&#8217;ve put dtproperties in there because that is the internal table that was showing up when I didn&#8217;t want it to.</p>
<p>I&#8217;ve tested this in SQL Server 2008, but I suspect that it should be good for anything from SQL 7.0 upwards.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://FriendSite.com/users/bookmarks/?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;t=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;FriendSite"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/friendsite.png" title="Add to&nbsp;FriendSite" alt="Add to&nbsp;FriendSite" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;title=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shoutwire.com/?p=submit&amp;link=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F" rel="nofollow" title="Add to&nbsp;Shoutwire"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/shoutwire.png" title="Add to&nbsp;Shoutwire" alt="Add to&nbsp;Shoutwire" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2010%2F05%2F25%2Ffinding-missing-foreign-keys-in-transact-sql-for-ms-sql-server%2F&amp;t=Finding+missing+foreign+keys+in+Transact+SQL+%28for+MS+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2010/05/25/finding-missing-foreign-keys-in-transact-sql-for-ms-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Locking Records to Prevent Editing in Transact SQL (Microsoft SQL Server)</title>
		<link>http://rainstorms.me.uk/blog/2009/10/06/locking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server/</link>
		<comments>http://rainstorms.me.uk/blog/2009/10/06/locking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 22:50:08 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Lock]]></category>
		<category><![CDATA[Lock Record]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transact]]></category>
		<category><![CDATA[Trigger]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=266</guid>
		<description><![CDATA[Sometimes when I&#8217;m writing code, I come up with a solution that I&#8217;m particularly pleased with because it is just so neat.  This is one of those times. I&#8217;ve not been posting much on this blog recently because I&#8217;ve been very absorbed in a big project and been working crazy hours to get the coding [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Sometimes when I&#8217;m writing code, I come up with a solution that I&#8217;m particularly pleased with because it is just so neat.  This is one of those times.
</p>
<p>
I&#8217;ve not been posting much on this blog recently because I&#8217;ve been very absorbed in a big project and been working crazy hours to get the coding done.</p>
<p>
I should explain that this post is not about record locking to prevent concurrent update problems.  This is about being able to put a more permanent lock on a record in order to stop updates being made to it until the lock is removed.</p>
<p>
The project that I&#8217;ve been working on has some shared records in a few tables that are used by a large number of other records in other tables.   The problem is that something was overwriting these shared records, which was pretty disasterous.  I managed to resurrect the data, which wasn&#8217;t such a problem, but I was very worried about how to stop it happening again, since these records are accessed in a number of different places.
</p>
<p>
The obvious first step was to audit the code and check for what was doing it.  I did that and identified some likely suspects and built in some code to prevent it happening again, but I wanted more reassurance than that, so I decided to try to get SQL Server itself to enforce a lock on them.  The solution that I came up with was to use a trigger.
</p>
<p>
The code of the trigger is as follows</p>
<pre name="code" class="sql">
CREATE trigger [dbo].[trgEnforcePersonLock] ON [dbo].[Person]
for UPDATE
AS
BEGIN
	if (select count(*) From deleted WHERE Locked=1)>0 AND (select count(*) From inserted WHERE Locked=1)>0
	begin
		rollback transaction
		raiserror('Cannot modify a locked person!',16,1)
	end 

END
</pre>
<p>The inserted virtual table contains the new data and the deleted virtual table contains the old.  I&#8217;m checking that the update isn&#8217;t unlocking it, because otherwise we&#8217;ll never be able to!  It works by checking whether the record is locked and if so, rolling back the transaction and raising an error.  From testing, it looks like it works pretty well!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://FriendSite.com/users/bookmarks/?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;t=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;FriendSite"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/friendsite.png" title="Add to&nbsp;FriendSite" alt="Add to&nbsp;FriendSite" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;title=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shoutwire.com/?p=submit&amp;link=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F" rel="nofollow" title="Add to&nbsp;Shoutwire"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/shoutwire.png" title="Add to&nbsp;Shoutwire" alt="Add to&nbsp;Shoutwire" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F10%2F06%2Flocking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server%2F&amp;t=Locking+Records+to+Prevent+Editing+in+Transact+SQL+%28Microsoft+SQL+Server%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2009/10/06/locking-records-to-prevent-editing-in-transact-sql-microsoft-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Management Studio 2008 Import/Export Data (Replacement for DTS)</title>
		<link>http://rainstorms.me.uk/blog/2009/07/01/sql-management-studio-2008-importexport-data-replacement-for-dts/</link>
		<comments>http://rainstorms.me.uk/blog/2009/07/01/sql-management-studio-2008-importexport-data-replacement-for-dts/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 09:07:18 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[2005]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[Data Export]]></category>
		<category><![CDATA[Data Import]]></category>
		<category><![CDATA[Express]]></category>
		<category><![CDATA[SMSS]]></category>
		<category><![CDATA[SQL Management Studio]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=186</guid>
		<description><![CDATA[The old SQL Enterprise Manager used to have something called Data Transfer Services, which allowed you to transfer data between SQL Server and a different database using ODBC.  This was curiously lacking in SQL Server Management Studio 2005 (at least the Express one) unless I missed it. However, in the 2008 version, you can right [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The old SQL Enterprise Manager used to have something called Data Transfer Services, which allowed you to transfer data between SQL Server and a different database using ODBC.  This was curiously lacking in SQL Server Management Studio 2005 (at least the Express one) unless I missed it.</p>
<p>However, in the 2008 version, you can right click on a database, select All Tasks and there are options for Import Data and Export Data, which open an appropriate wizard to guide you through the process.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://FriendSite.com/users/bookmarks/?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;t=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;FriendSite"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/friendsite.png" title="Add to&nbsp;FriendSite" alt="Add to&nbsp;FriendSite" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;title=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shoutwire.com/?p=submit&amp;link=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F" rel="nofollow" title="Add to&nbsp;Shoutwire"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/shoutwire.png" title="Add to&nbsp;Shoutwire" alt="Add to&nbsp;Shoutwire" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F07%2F01%2Fsql-management-studio-2008-importexport-data-replacement-for-dts%2F&amp;t=SQL+Management+Studio+2008+Import%2FExport+Data+%28Replacement+for+DTS%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2009/07/01/sql-management-studio-2008-importexport-data-replacement-for-dts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

