<?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; Microsoft SQL Server</title>
	<atom:link href="http://rainstorms.me.uk/blog/tag/microsoft-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>Tue, 07 Sep 2010 07:41:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>sp_change_users_login and ALTER USER</title>
		<link>http://rainstorms.me.uk/blog/2010/08/23/sp_change_users_login-and-alter-user/</link>
		<comments>http://rainstorms.me.uk/blog/2010/08/23/sp_change_users_login-and-alter-user/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 10:25:35 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ALTER USER]]></category>
		<category><![CDATA[auto_fix]]></category>
		<category><![CDATA[CREATE LOGIN]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[sp_change_users_login]]></category>
		<category><![CDATA[Transact SQl]]></category>
		<category><![CDATA[update_one]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=322</guid>
		<description><![CDATA[I previously posted about using sp_change_users_login to repair users that have become disconnected from their logins eg. after transferring a database from one server to another.  I&#8217;ve just noticed that Microsoft have said that they will be removing sp_change_users_login from future versions of SQL Server and to use ALTER USER instead, so I thought it [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://rainstorms.me.uk/blog/2010/02/21/using-sp_change_users_login-auto_fix-to-fix-userlogin/">previously posted</a> about using sp_change_users_login to repair users that have become disconnected from their logins eg. after transferring a database from one server to another.  I&#8217;ve just noticed that <a href="http://msdn.microsoft.com/en-us/library/ms174378.aspx">Microsoft have said that they will be removing sp_change_users_login from future versions of SQL Server and to use ALTER USER instead</a>, so I thought it would be interesting to look at the functionality of the 2, first of all to see how to use ALTER USER to achieve the same functionality as the &#8216;auto_fix&#8217; and also to see what other functionality is available in the 2 alternatives.</p>
<p>Just a bit of background first in case you aren&#8217;t clear on the SQL Server terminology.  A login consists of a username and some means of authenticating (usually a password or Windows authentication, but it could be a certificate or key).  It also has a default database and language.  It is stored at the <strong>server</strong> level and can have server wide roles.  This doesn&#8217;t affect the rights within a specific database though.</p>
<p>A user has a name and is connected to a login.  It is stored at the <strong>database</strong> level and it has particular roles for that specific database that affect the permissions for that user.  A login can have multiple users, but a user can only have one login.  When you log in as a specific login and try to access a database, SQL server looks to find a user in that database that maps to the login and applies permissions appropriately.</p>
<p>When you move databases from one server to another, reinstall SQL server as a new instance or similar situations, the user and the login become disconnected and you can&#8217;t login any more.  In principle, you could just delete the user and recreate it from the login, but that isn&#8217;t always practical, either because you have lots of them to do, or commonly because the user owns certain objects in the database and it isn&#8217;t in a state where it can be deleted.  In practice, therefore, it is necessary to have a way to reconnect a user and login.</p>
<p>My <a href="http://rainstorms.me.uk/blog/2010/02/21/using-sp_change_users_login-auto_fix-to-fix-userlogin/">previous post</a> was about how to reconnect these using sp_change_users_login with the &#8216;auto_fix&#8217; parameter, but as I have said, Microsoft are removing that and we are supposed to use ALTER USER instead.</p>
<p>So what else can sp_change_users_login do apart from reconnecting users and logins?  It has 4 parameters: -</p>
<ol>
<li>@Action</li>
<li>@UserNamePattern</li>
<li>@LoginName</li>
<li>@Password</li>
</ol>
<p>The @Action one is the one that we&#8217;ve been using as &#8216;Auto_Fix&#8217; (capitalisation isn&#8217;t important).  There are 2 other valid values for @Action, which are &#8216;Report&#8217; and &#8216;Update_One&#8217;.  I&#8217;ll come back to these in a minute, but first, let&#8217;s see what else we can do with &#8216;Auto_Fix&#8217;.</p>
<p>The &#8216;Auto_Fix&#8217; action has a second usage &#8211; if you specify a password in @Password then it will create the login if it doesn&#8217;t already exist.  If the login does already exist then @Password is ignored.  Either way, @LoginName must be left out or explicitly set to NULL.</p>
<p>The &#8216;Report&#8217; action reports on any users that aren&#8217;t linked to a login.  @UserNamePattern, @LoginName and @Password should all be set to NULL or left blank.  This is useful if you want to check to see if there are any unmapped users that can be deleted or if anything has gone wrong and users have been disconnected.  This also returns the security identifier (SID) with the username.  The SID is SQL Server&#8217;s ID field for keeping track of users.  This is stored as a GUID, which is a binary field.  I&#8217;m not going to post about GUIDs here, but I may post more about them in future.</p>
<p>The final type of action is &#8216;Update_One&#8217;.  This attaches a user to a specific login.  @UserNamePattern must be set to the correct user, @LoginName must be set to the correct login name.  @Password should be left out or NULL.  Presumably this will re-map a user that is currently connected to an existing login to a different one if you want, but I haven&#8217;t actually tested this.</p>
<p>That&#8217;s everything that sp_change_users_login does.  The question is, how to reproduce this functionality with ALTER USER and any methods that aren&#8217;t marked as obsolete.  I see there being 5 possible operations here: -</p>
<ol>
<li>reattach a user to a matching login name by just specifying the user (&#8216;auto_fix&#8217;)</li>
<li>create a login name for a user by specifying a password (&#8216;auto_fix&#8217;)</li>
<li>reattach a user if the login exists and if not then create it with the specified password (&#8216;auto_fix&#8217;)</li>
<li>find users that aren&#8217;t attached to a login (&#8216;report&#8217;)</li>
<li>connect a user to an existing login (&#8216;update_one&#8217;) (I don&#8217;t think it is relevant whether or not the user is currently connected &#8211; this is still one operation)</li>
</ol>
<p>I&#8217;ll go through these one at a time (please note that this bit isn&#8217;t tested, so it might need some correction, but it should work in principle)&#8230;</p>
<p>reattaching a user to a login: -</p>
<pre>ALTER USER <em>username</em> WITH LOGIN = <em>loginname</em></pre>
<p>where <em>username</em> and <em>loginname</em> are the same.</p>
<p>create a login name for a user by specifying a password: -</p>
<pre>CREATE LOGIN <em>loginname</em> WITH PASSWORD = <em>password</em>;</pre>
<pre>GO</pre>
<pre>
<pre>ALTER USER <em>username</em> WITH LOGIN = <em>loginname</em>;</pre>
</pre>
<p>Again, where <em>loginname</em> and <em>username</em> are the same and <em>password </em>is the password.</p>
<p>reattach a user if the login exists and if not then create it with the specified password: -</p>
<p>The simplest way of doing this is actually to just do the same as above -</p>
<pre>CREATE LOGIN loginname WITH PASSWORD = password;</pre>
<pre>GO</pre>
<pre>
<pre>ALTER USER username WITH LOGIN = loginname;</pre>
</pre>
<p>Again, where <em>loginname</em> and <em>username</em> are the same and <em>password </em>is the password.  If the login exists, the first statement will throw an error, but the second one will use the login anyway.  This is fine if you don&#8217;t care about errors.  If you want something a bit more robust then you&#8217;d have to do something like using IF EXISTS on a query to find the name in master.sys.server_principals, checking that you are looking at a type of principle that is a login type and not a role or anything else.  If it doesn&#8217;t exist then use the above top line to create it, then end the IF and then either way run the ALTER USER statement to attach the user to the login.</p>
<p>to find users that aren&#8217;t attached to a login: -</p>
<pre>select UserName = name, UserSID = sid from sysusers
where issqluser = 1
and   (sid is not null and sid &lt;&gt; 0x0)
and   (len(sid) &lt;= 16)
and   suser_sname(sid) is null
order by name</pre>
<div>I&#8217;ve actually taken this from the sp_change_users_login source code!</div>
<div></div>
<div></div>
<div>connect a user to an existing login: -</div>
<div>
<pre>ALTER USER <em>username</em> WITH LOGIN = <em>loginname</em>;</pre>
<p>This time,  <em>username</em> and <em>loginname</em> may actually be different.  This is exactly the same code as above though.</p>
<p>It does appear as though there are really only 2 SQL statements that you need to be able to reproduce the majority of the functionality of this stored procedure, so it shouldn&#8217;t be a major problem to replace your code.</p>
</div>
<!-- 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;t=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;title=sp_change_users_login+and+ALTER+USER" 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%2F08%2F23%2Fsp_change_users_login-and-alter-user%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%2F08%2F23%2Fsp_change_users_login-and-alter-user%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%2F08%2F23%2Fsp_change_users_login-and-alter-user%2F&amp;t=sp_change_users_login+and+ALTER+USER" 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://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2010/08/23/sp_change_users_login-and-alter-user/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://mitcho.com/code/yarpp/'>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://mitcho.com/code/yarpp/'>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>
	</channel>
</rss>
