Query not running

  • if exists(select * from t1 or select * from t2)

    begin

    select 'xxx'

    end

    not running. suggestion ?

  • the error you getting after running the query, clearify the reason itself.

    See the error in your query result window.

    ----------
    Ashish

  • Isn't it possible to use more than one condition inside if exists() ?

  • Isn't it possible to use more than one condition inside if exists() ?

    There are not two condition, there are totally 2 different select statement which are no where related to each other to be compared by OR operator

    if exists(select * from t1 or select * from t2)

    ----------
    Ashish

  • EXISTS operator only works with single SELECT statement. In your case it will work as mentioned below..

    if exists(select * from t1) or exists(select * from t2)

    begin

    select 'xxx'

    end

    Abhijit - http://abhijitmore.wordpress.com

Viewing 5 posts - 1 through 4 (of 4 total)

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