enfany
enfany

Reputation: 895

How to find out table lock or row lock in Sybase

I have a stored procedure in Sybase, it's called by the Java code on a row by row insertion, how do I find out whether this SP is locking table or locking row? To check the underlying table properties or the SP itself?

CREATE PROCEDURE dbo.sp1
(@id_code             varchar(10), 
 @position_id         numeric(10,0)  OUTPUT
)
AS
BEGIN
    BEGIN TRANSACTION

    INSERT INTO abc..table1(
            id_code,
            position_id
        )
        values (
            @id_code
            @position_id
        )        
    COMMIT

    SELECT @position_id = @@identity    
END
go
EXEC sp_procxmode 'dbo.sp1', 'unchained'
go
IF OBJECT_ID('dbo.sp1') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.sp1 >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.sp1 >>>'

Upvotes: 1

Views: 9897

Answers (1)

Mike Gardner
Mike Gardner

Reputation: 6651

The lock scheme for a table can be determined using the lockscheme() built in command.

lockscheme('tableName')

You can also specify obj_id and dbid.

ASE 16 Documentation: lockscheme

Upvotes: 1

Related Questions