• sorry.... Portuguese...

    Somente um parenteses Luis...

    --Here i need an IF condition to test

    SELECT tam FROM sgt WHERE tam = 'Y' AND ref = @ref -- I need to check if already exist Y on field TAM of

    Para colocar em uma variável

    SELECT @tam-2=SUA_COLUNA FROM ...... ter a certeza que retornará somente uma linha...

    aí depois vc pode utilizar if @tam-2=.....

    Um abraço,

    Carlos

    Suggestion by Chris perfect - No Cursor...