pass the multiple query in single IF statement

  • hi

    I am getting the following error while executing the program.

    Incorrect syntax near the keyword 'else'.

    declare @id as int

    set @id=5

    if(@id>2)

    print 's'

    print 'b'

    else

    print 'r'

    Any Ideas?

  • You need a BEGIN/END around the statements between your IF and ELSE.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • it's working.

    thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply