Query optimization

  • if i use select @Value  in a query rather using "if exists" it impacts on query optimization if yes then plz suggest what

    Example:

    if not exists(select zcmCPR_V_CPRNO  from ZCM_CPR where zcmCPR_V_CPRNO=@zcmASM_V_CPRITEMNO)

     

    -----activities--------  

    or

    select @Value=zcmCPR_V_CPRNO  from ZCM_CPR where zcmCPR_V_CPRNO=@zcmASM_V_CPRITEMNO

       ---------------------------------------------------------------

      if @Value<>''

    ------activities-------

  • Hi,

    I am not sure from the optimization point of view however from the syntax point of you can us

    if @value IS NOT NULL

    BEGIN

    ----Statements ----

    END

    else

    BEGIN

    ----Statements ----

    END

    Thanks

    Prasad Bhogadi
    www.inforaise.com

  • Thanks Prasad,but here i am looking for performance issue not syntax

    Thanks

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

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