Welcome to Sign in | Help

modificare sql proc - deadlock sql server 2008

  •  03-29-2011, 12:12 PM

    modificare sql proc - deadlock sql server 2008

    salut, am procedura stocata de mai jos pe un sql server 2008

    CREATE proc VireazaSal
    @ImportRef int,
    @IBANAngajat varchar(50) ,
    @ContD varchar(50),
    @Suma money,
    @ContC varchar(50),
    @DataTr datetime,
    @DataExec datetime,
    @Comment varchar(200)
    as
    set nocount on
    declare @text varchar(200)

    if exists(select top 1 1 from V_SAL where ImportRef = @ImportRef and Virat = 0 and IBAN = @IBANAngajat)
    begin
    exec ExecTrans @ContD, @Suma, @ContC, @DataTr, @DataExec, @Comment

    update V_SAL
    set Virat = 1
    where ImportRef = @ImportRef and IBAN = @IBANAngajat and Virat = 0
    end
    else
    begin
    set @text = 'Suma a fost virata deja pt IBAN: ' + @IBANAngajat
    raiserror(@text, 1, 1)
    end
    go

    cateodata se intampla ca procedura ExecTrans sa dea deadlock si atunci nu vreau sa-mi mai faca update-ul cu Virat = 1, ce conditie trebuie sa pun a.i. update-ul cu Virat = 1 sa se faca doar daca ExecTran a fost executata cu succes?

    Multumesc.
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems