﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 7,2000 / T-SQL  / using locks in sql server 2005 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 11:20:14 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: using locks in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1421048-8-1.aspx</link><description>[quote][b]vinodkel (3/1/2013)[/b][hr]thanks for your kind reply:-)agreed, constraint can be used instead of trigger.but the requirement is something different, if i use constraint it will check the defined uniqueness within the table and raise error or rollback the process. which i don't want to do, I want to simply check if the duplicity and if found do nothing (nor insertion of record).[/quote]While I don't condone this approach you could use an INSTEAD OF INSERT trigger. Your trigger body would simply be an insert where not exists. The performance will likely be slower than a unique constraint but it would solve the issue. A better approach might be to use an insert stored proc that only inserts the valid data. This could be a great place for a MERGE, the good rows get inserted and the duplicates get logged.</description><pubDate>Mon, 04 Mar 2013 07:42:15 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: using locks in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1421048-8-1.aspx</link><description>thanks for your kind reply:-)agreed, constraint can be used instead of trigger.but the requirement is something different, if i use constraint it will check the defined uniqueness within the table and raise error or rollback the process. which i don't want to do, I want to simply check if the duplicity and if found do nothing (nor insertion of record).</description><pubDate>Fri, 01 Mar 2013 22:57:40 GMT</pubDate><dc:creator>vinodkel</dc:creator></item><item><title>RE: using locks in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1421048-8-1.aspx</link><description>You should use a unique constraint instead of a trigger to check for this type of thing.[url=http://msdn.microsoft.com/en-us/library/ms191166.aspx]http://msdn.microsoft.com/en-us/library/ms191166.aspx[/url]</description><pubDate>Wed, 27 Feb 2013 09:34:14 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: using locks in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1421048-8-1.aspx</link><description>thanks for the comments :-)will try this and get back</description><pubDate>Wed, 27 Feb 2013 08:58:18 GMT</pubDate><dc:creator>vinodkel</dc:creator></item><item><title>RE: using locks in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1421048-8-1.aspx</link><description>1. Revise the code to implement the best practices.2. Make sure you have appropriate indexes in place and your code in trigger uses it.Having these conditions fulfilled you should not have trouble with multiple calls within milliseconds.I saw 10 SP calls completed successfully within 0.01 s on a 10 years old server running SQL2000. And those procedures were not ideal ones in terms of optimisation.</description><pubDate>Mon, 18 Feb 2013 17:50:19 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>using locks in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1421048-8-1.aspx</link><description>i have one table, concurrently multiple users are hiting the table through insert action.i have placed trigger on the table to have check uniqueness with multiple fields within the table.As concurrent users are inserting records in the table at the same time with difference of mili seconds that trigger is not be able to check the duplicity while inserting records.pls suggest...</description><pubDate>Mon, 18 Feb 2013 00:22:16 GMT</pubDate><dc:creator>vinodkel</dc:creator></item></channel></rss>