optimization

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • logesh
    New Member
    • Sep 2006
    • 2

    optimization

    hi,
    i have written a qurey to retive some data form a table,but i want the qurey should be more faster, i dont want to set index, other that that,if any.
    advice required!!!!!

    THIS THE QUREY
    ----------------------------


    select intpurchaseqty, strCurrencyCode as Currency,intDen omination as Denomination,ca se
    when strPrefix ='' then '0' else strprefix end as Prefix,strSrlno From as From_, "
    strsrlnoTo as To_ from tblfxrows where intBranchCode=5
    and strInstrumentty pe ='TC' and ( left(intEncashm entID,2) like 'TR%' or
    (intTransferedF romID like 'IB%' and inttransactionr ate = 0)) and datTransactiond ate <= convert(datetim e,
    '05/01/5006',103) and dattransactiond ate >= '05/01/2006' "
  • Senthil
    New Member
    • Sep 2006
    • 10

    #2
    Hi,

    I can give an idea that.
    1. replace like with '=' sign(like left(intEncashm entID,2) ='TR')
    2. instead of case, can use isnull/replace.
    3. Use '(nolock)'.

    Regards,
    Sharmila



    Originally posted by logesh
    hi,
    i have written a qurey to retive some data form a table,but i want the qurey should be more faster, i dont want to set index, other that that,if any.
    advice required!!!!!

    THIS THE QUREY
    ----------------------------


    select intpurchaseqty, strCurrencyCode as Currency,intDen omination as Denomination,ca se
    when strPrefix ='' then '0' else strprefix end as Prefix,strSrlno From as From_, "
    strsrlnoTo as To_ from tblfxrows where intBranchCode=5
    and strInstrumentty pe ='TC' and ( left(intEncashm entID,2) like 'TR%' or
    (intTransferedF romID like 'IB%' and inttransactionr ate = 0)) and datTransactiond ate <= convert(datetim e,
    '05/01/5006',103) and dattransactiond ate >= '05/01/2006' "

    Comment

    • aneeshattingal
      New Member
      • Jul 2006
      • 8

      #3
      Replace
      ( left(intEncashm entID,2) like 'TR%' with

      LEFT(intEncashm entID,2) = 'TR'

      also make sure that there is an index on that column

      Comment

      Working...