Forum Replies Created

Viewing 15 posts - 8,461 through 8,475 (of 10,144 total)

  • RE: CASE statement kills performance

    David, I reckon there's an error in the WHERE clause - it's challenging writing code with no data to test against - but try this:

    WHERE date_sent between @start_date and @end_date

    and...

  • RE: CASE statement kills performance

    Hi David

    I'd try it with the following values first:

    @vendor_name = '(All)'

    @search_type = 'Parent Company'

    and if this fails, then deconstruct the two new operations in the WHERE clause, perhaps...

  • RE: Use Exist

    mithun.gite (4/17/2009)


    GilaMonster (4/17/2009)


    mithun.gite (4/17/2009)


    See, anyone who sees the query can guess that its not the actual query to optimize,,

    Then what was the point of posting it?

    its just a matter...

  • RE: CASE statement kills performance

    Hi David, give the following a try:

    SELECT

    vrd.request_id,

    vrd.wk_ref,

    convert(varchar,vrd.[date],103) as date_recorded,

    vrq.request_type,

    vrd.add_ref,

    vpc.parent_company,

    vrd.vendor_name,

    vrd.cca,

    vrd.litigation,

    vr.reason_required,

    convert(varchar, NULLIF(vrd.date_received, '1900-01-01'), 103) AS date_received,

    datediff(dd,vrd.date_requested,case vrd.date_received when '1900-01-01' then vrd.date_requested else vrd.date_received end) as days_to_receipt,

    convert(varchar, NULLIF(vrd.deadline_date, '1900-01-01'), 103) AS deadline_date,

    convert(varchar,...

  • RE: Use Exist

    mithun.gite (4/17/2009)


    GilaMonster (4/17/2009)


    mithun.gite (4/17/2009)


    Actually I have been asked to Optimize the query and do the performance tunning to the query.

    select * from emp where dept_no in(10,20,30)

    As in this query only...

  • RE: Use Exist

    mithun.gite (4/17/2009)


    There is a big performnace problem with using Exists in this example,, so can i say that if we are passing static values in where clause then its better...

  • RE: How to simplify a "negative a zero" formula

    SELECT CASE WHEN @aFrom > @aCount THEN 0 ELSE CEILING((@aCount-@aFrom+0.0001)/@aRatio) END

  • RE: Are the posted questions getting worse?

    RBarryYoung (4/16/2009)


    john.arnott (4/16/2009)


    Am I so obsessed with big round numbers that I would ...

    Coincidentally, that's also how I got my first date... :w00t:

    C'mon Barry ya can't just leave this...

  • RE: Use Exist

    mithun.gite (4/17/2009)


    Dear Friends,

    I have one query like

    select * from emp where dept_no in(10,20,30)

    Can anyone help me in using EXISTS instead of IN ?

    Pls.....

    Thanks in Advance

    Mithun

    SELECT *

    FROM emp a

    WHERE...

  • RE: Querying table with varchar datatype column

    sacheen.nemade (4/17/2009)


    Hi

    Agentid - Integer

    Chain - Varchar(2000)

    Chain , it contains all sub-agents(Agentid) list seprated by '-'

    For eg

    agentid 100

    chain would be 100-101-102

    Chain gets longer as new...

  • RE: Querying table with varchar datatype column

    Please can you provide a script for table arr2, and some sample data. The link below will show you how to provide sample data in a format which is convenient.

    Is...

  • RE: Retrieve AD account's group using OpenQuery

    Shayne.Gui (4/16/2009)


    I want to retrieve a AD account's group which means its [memberof] field in AD,

    but I don't know how to get it using Openquery,a user may have multivalue of...

  • RE: Are the posted questions getting worse?

    Well-known films by Stanley Thread:

    Fear and The Thread

    Thread's Kiss

    Threads of Glory

    Marriage to The Thread

    The Thread moves to England

    Dr. Strangethread

    2009: A Thread Odyssey

    A Clockwork Thread

    R Barry Thread

    The Threading

    Full Metal Thread

    Eyes Sewn...

  • RE: CASE statement kills performance

    Hello

    First thing I'd do with this is take the switch out of the join:

    @search_type = 'Parent Company', tv.vendor_name = '(All)'

    - inner join @vendor_names_tab tv ON vpc.parent_company = vpc.parent_company --...

  • RE: Results in one row when using an INNER JOIN that returns multiple rows

    Check out this excellent article[/url] by Jeff Moden.

    Cheers

    ChrisM

Viewing 15 posts - 8,461 through 8,475 (of 10,144 total)