• Good article, and better than its rating indicates. (So I gave it 5 * to balance it.)

    A few days ago I captured this in a trace, when a customer complained of a few time-outs. I suspect that one of their developer uses a self-made program to query the database for our application:

    declare @p1 int

    set @p1=1

    declare @p2 bigint

    set @p2=175483777308924

    exec [sys].sp_getschemalock @p1 output,@p2 output,N'"dbo"."customer"'

    select @p1, @p2

    declare @p1 int

    set @p1=41

    exec sp_prepexec @p1 output,N'@P1 int',N'SELECT "Tbl1005"."customer_id" "Col1127","Tbl1005"."code" "Col1136" FROM "dbo"."customer" "Tbl1005" WHERE @P1="Tbl1005"."customer_id"',99534

    select @p1

    go

    exec sp_execute 41,99551

    go

    >>> Many dozens of sp_execute....

    exec sp_unprepare 41

    go

    exec [sys].sp_releaseschemalock 1

    go

    And within a few seconds the same code, and again, and again...

    I would very much like to know what the effect is of this snippet:

    exec [sys].sp_getschemalock @p1 output,@p2 output,N'"dbo"."customer"'

    ... but haven't found the time to investigate it.


    Dutch Anti-RBAR League