Question: My case scenario passes parameter to a procedure, that only does an insert. But two threads might try to pass the same value. 

How to handle this situation w/out throwing an exception and with least amount of locks?

My performance requirement is at least 10k inserts per second.

**EDIT:** Column is unique. Timestamp might be altered (adjusted) before insertion.

Answer: 
Create index on table with ignore duplicate key option. It will not insert duplicate row and also won't through any error.

E.g.

```
create unique index i1 on #tmp(id) with ignore_dup_key

insert into #tmp values(1,"A")
2> go
(1 row affected)

1> insert into #tmp values(1,"A")
2> go
Duplicate key was ignored.
(0 rows affected)

```
As **@Martin Smith** has pointed out there is good solution - even though it is contrary to my question, it has good reasoning behind that seems well supported. The original answer you can find [here](https://stackoverflow.com/questions/3407857/only-inserting-a-row-if-its-not-already-there/3408196#3408196) posted by **@gbn**.

```
BEGIN TRY
   INSERT etc
END TRY
BEGIN CATCH
    IF ERROR_NUMBER() <> 2627
      RAISERROR etc
END CATCH

```

> 
> Seriously, this is quickest and the most concurrent without locks, especially at high volumes. What if the UPDLOCK is escalated and the whole table is locked?
> 
> 
> 

The original text by Paul Nielsen you can find [here](http://sqlblog.com/blogs/paul_nielsen/archive/2007/12/12/10-lessons-from-35k-tps.aspx). - lesson 4.

If anyone has a similar problem to mine it is good to have a look at it.