1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Can the function exists be used with a return value from the select?

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 1, 2024 às 09:13.

  1. Stack

    Stack Membro Participativo

    what error in this code

    if exists(select top 1 @entNum = entNum from View_Entry where typeID=@typeID and DocID= @entDayID)
    begin
    delete from [tbEntry] where [DocID]=@entDayID and [typeID]=@typeID
    end
    else
    begin
    select @entNum =ISNULL(max(entNum)+1,1) from dbo.tbEntry
    end


    error Messages


    Msg 102, Level 15, State 1, Procedure tr_EntDay_tbEntry_INSERT_UPDate, Line 19 Incorrect syntax near '='. Msg 156, Level 15, State 1, Procedure tr_EntDay_tbEntry_INSERT_UPDate, Line 23 Incorrect syntax near the keyword 'else'.

    I con not find error

    Continue reading...

Compartilhe esta Página