Forum Replies Created

Viewing 15 posts - 2,176 through 2,190 (of 2,894 total)

  • RE: if exists condition

    Absolutely! It was cut-&-paste issue. Didn't put the second one after unconditional set noexec off.

    if (OBJECT_ID('p_a') is null) SET NOEXEC OFF;

    GO

    if (OBJECT_ID('p_a') is not null) SET NOEXEC ON;

    GO

    create proc...

  • RE: SQL Query Assistance - Filtering on unique Patients by specific provider with shared patients

    Please try to post your question in accordance with forum etiquette, you can find the link at the bottom of my signature.

    You can use following query to get the list...

  • RE: if exists condition

    Phil Parkin (2/14/2012)


    That's ugly, but also taught me something, thanks! 🙂

    Ugly is a very subjective view.

    In my opinion it's quite extravagant 🙂

    It's usefull when you want to stop batch script...

  • RE: if exists condition

    You need to be a bit more creative with your T-SQL batch to achieve what you want :-D:

    if (OBJECT_ID('p_a') is null) SET NOEXEC OFF;

    GO

    if (OBJECT_ID('p_a') is not null) SET...

  • RE: Grouping on CASE statements = slow query?

    Ok, your "results start coming instantly" means nothing, as most likely they will take even longer to come out in full than SELECT INTO. 1.8 millions should not take 2.30...

  • RE: Grouping on CASE statements = slow query?

    I would try to SELECT INTO #table the result of the query including the calculated columns used for grouping (without grouping itself), then the final query would select from #table...

  • RE: SP taking far longer to run than code within

    It was just a guess which worked, however it could be down to the code inside of proc. It is always good to post code when asking performance question!

    Also, playing...

  • RE: SP taking far longer to run than code within

    Post your proc code!

    Try:

    SET ANSI_NULLS ON

    GO

    Before creating your proc.

  • RE: Please help on Logic

    xRafo (2/9/2012)


    if the temporary table is in dynamic sql?

    So what? You can use temp # tables in dynamic sql.

    What is you point?

  • RE: Please help on Logic

    You can optimise the solution even further. Few tips:

    1. Create Error table on fly using SELECT INTO and UNION ALL

    2. You may find that before loading data to the final...

  • RE: the TSQL code for this query...is needed.

    J Livingston SQL (2/9/2012)


    I believe the COUNT(*) needs to be COUNT(DISTINCT VendorName) to allow a single vendor to have more than one presence in the city.

    absolutely agree...but should it be...

  • RE: Grouping on CASE statements = slow query?

    Could you please provide the full query at least, please. Grouping is relatively expensive operation as well as string concatination. It's impossible to advise on optimisation without having underlying object...

  • RE: Please help on Logic

    If you want to do it in the hand crafted T-SQL, you can do the following:

    Import all data into the staging table with reasonbaly maximum unrestricted varchar datatype for ...

  • RE: the TSQL code for this query...is needed.

    Jeff, that why I said "one of". I was afraid to recommend using "HAVING COUNT..." as it could be even harder to explain to his "instructor".

    However, if...

  • RE: the TSQL code for this query...is needed.

    Ask your "instructor" what will happen if two different states have the city with the same name?

    The solution given to you is not only wrong, but also would perform badly...

Viewing 15 posts - 2,176 through 2,190 (of 2,894 total)