Forum Replies Created

Viewing 15 posts - 916 through 930 (of 1,413 total)

  • Reply To: How to compare strings by letters in certain places

    Jeff Moden wrote:

    BOR15K wrote:

    Thank you, Steve

    Sadly none of your examples works for me from the Studio - getting various error messages.

    The code probably worked just fine for Steve.  When you get...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: How to compare strings by letters in certain places

    Maybe you do not have an fnTally function?  If so that's easily remedied.  Have a look at this thread.  What are the specific messages?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: How to compare strings by letters in certain places

    Here's for six letters.  It returns Bertha.  To do for five letters would follow a similar pattern.

    DECLARE @six_letters NVARCHAR(MAX) = 'hurrah, buzzed, Bertha, patter, mettle, holler, collie,...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: How to compare strings by letters in certain places

    DECLARE @six_letters NVARCHAR(MAX) = 'hurrah, buzzed, Bertha, patter, mettle, holler, collie, yuppie, rabble, tallow, brooks, tassel, meddle, callus, peddle, sobbed, kneels, getter, brooms, dulled, maggot, webbed' ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Use a while loop or cursor for querying row by row and insert results into temp

    Maybe have a look at this other thread where something similar was discussed.

    https://www.sqlservercentral.com/forums/topic/ignoring-error-and-continue/page/2/#post-3765149

    Not the connecting using openrowset but the loop and the error and continue

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Desktop or Laptop for Remote Work

    Jonathan Gennick wrote:

    For the road I have a small-form-factor laptop that fits nicely on an airline tray table.

    That's what I should've done.  My Asus laptop with a 17" screen weighs like...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: EF Code-First

    Jeff Moden wrote:

    You should write an article on it and submit it. 

    Steve Collins wrote:

    ...I'll submit something.

    Since this was written I've been on this trying to make it happen.  Wow, 3 months ago...

    Attachments:
    You must be logged in to view attached files.

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    Mysterio wrote:

    What I dislike about PIVOT is that you have to repeat UNIONs several times depending on the metric. This makes it difficult to change and error-prone as you may...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sum function in CTE is not calculating the right balance

    Frank's answer above removes the reference to the CODE_CHARGECREDIT table and removes c.PEOPLE_ORG_ID (which is non-existent) from the GROUP BY.  Idk if that makes sense.  Fixing the (many) errors and...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    Horses for courses and everybody thinks their way is the best.  Why not have a sense of humor about it?  I agree Pivot and Unpivot are kludge compared to conditional...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    ScottPletcher wrote:

    Here's a simple CASE, what wouldn't this take embedded IIFs?

    Idk why don't you give it a try and let us know

    ScottPletcher wrote:

    ... since I write SQL now not a...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    Ha I think's the other way around.  CASE WHEN is an abomination of over wordiness that never should've been created.  First, back in the day you used to have to...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    Imo IIF gets hated on because it was available first in MS Access.  IIF gets interpreted back to "CASE WHEN" so it's really the same (which is a shame because...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    It also works without the tally table and just using CROSS APPLY

    select
    po.ProductCategory, po.ProductSubCategory, v.Region, v.OrdersPlaced,
    (v.OrdersPlaced*100.0/SUM(v.OrdersPlaced) over (partition by po.ProductCategory)) PercentPlaced
    from #po po
    ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using Pivot in SQL

    sgmunson wrote:

    Why not just UNPIVOT, as shown here in a CTE:

    Both work.  The tally based is probably more efficient depending on scale.  It didn't occur to use a tally table...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

Viewing 15 posts - 916 through 930 (of 1,413 total)