I'm confused. Do you want to insert a record and then acquire a row lock on it and hold it for a length of time? Why? This could (and probably will) affect your concurrency.
-Mike
>Hi,
>
>
>
>CREATE TABLE dbo.test
>(
> id int IDENTITY (1, 1) NOT NULL
> ,Tx char(10) NOT NULL
> ,Gruppo tinyint NOT NULL
>)
>
>INSERT INTO dbo.test VALUES ('a',1)
>INSERT INTO dbo.test VALUES ('B',1)
>INSERT INTO dbo.test VALUES ('C',1)
>INSERT INTO dbo.test VALUES ('az',2)
>INSERT INTO dbo.test VALUES ('Bz',2)
>INSERT INTO dbo.test VALUES ('Cz',2)
>
>
>I need this:
>- lock dbo.test for INSERT from other session
>- allow SELECT from other session ( UNLOCK or READPAST )
>
>I have resolve this.
>
>I need this:
>- lock dbo.test for INSERT from other session
> only for INSERT with Gruppo=1
>- allow SELECT from other session ( UNLOCK or READPAST )
>
>Example:
>if on another session is execute:
>INSERT INTO dbo.test VALUES ('asdasd',2)
>this command insert VALUES ('Cz',2) and can continue without problem;
>
>if on another session is execute:
>INSERT INTO dbo.test VALUES ('asdasd',1)
>this command is locked and wait lock release.
>
>I can do it on Microsoft SQL ?
>
>On Oracle or DB2 a can do it ?
>
>Fabio
>
>
>I have resolve this.