Forum Replies Created

Viewing 15 posts - 676 through 690 (of 1,419 total)

  • Reply To: Problem with conversion from char to datetime

    Rereading what both Jeffery and me posted, it's correct and doesn't need editing.  The CONVERT is not necessary.  Frederico is also correct too.  CONVERT will work if the correct format...

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

  • Reply To: Problem with conversion from char to datetime

    frederico_fonseca wrote:

    datetime DOES have a format on convert - and that is what is causing it to fail.

    format 1 is US - so date string should be on format...

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

  • Reply To: Problem with conversion from char to datetime

    Datetime has no format so using CONVERT with a format code is not necessary.  The code should work if CONVERT is completely removed.  Or you could use CAST instead.

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

  • Reply To: Pivot table for report

    Not too long ago there was a question for SQL Server 2012 with pretty much the same pattern.

    https://www.sqlservercentral.com/forums/topic/how-to-make-pivot-to-feature-values-based-on-part-ca-and-x-exist-on-input-data/#post-3822116

     

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

  • Reply To: Pivot table for report

    Yes, no STRING_AGG in 2012.  We're in the 2016 Forum 🙂  To revert you could use STUFF+XML instead of STRING_AGG.

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

  • Reply To: Pivot table for report

    Not dynamic

    select tmp_channel, tmp_entity,
    sum(case when tmp_category='Cat1' then tmp_charges else 0 end) cat1,
    sum(case when...

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

  • Reply To: Deadlocks during concurrent delete operation

    A man goes to the doctor and says, "Doc, it hurts when I do this."  The doctor's response: "Don't do that."  What about not deleting the data within the transaction?

     

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

  • Reply To: extract name to 3 single columns

    I think you're looking for something like this.  The first CROSS APPLY 'cma_check(cnt)' counts the number of commas.  The second CROSS APPLY 'wrd_check(cnt)' counts the number of words in the...

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

  • Reply To: extract name to 3 single columns

    Yes I mostly agree with ratbak and I even narrowly agree with Joe.  If you've got access to pro software then use that 🙂  The code provided does sort of...

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

  • Reply To: extract name to 3 single columns

    The query could split the input into left and right strings based on the location of the comma.  Then determine if the trailing character of the right string is a...

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

  • Reply To: Query select.

    If the display order of the result set doesn't matter, using TOP(1) WITH TIES and ordering by the ROW_NUMBER

    select top(1) with ties *
    from #t1
    order by row_number() over...

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

  • Reply To: Splitting a group up into multiple groups using a score....

    Regarding the specifics of trading scenarios it's just not my cup of tea.  If there was a specific SQL question (or answer) without any lingo then maybe.  But so to...

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

  • Reply To: Getting sum of all transactions by month-end

    ;with
    loc_cte(loc) as (
    select distinct location
    from @tablom),
    n(n) as (
    select n
    from (values...

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

  • Reply To: Splitting a group up into multiple groups using a score....

    Thank you for your responses Rob.  It's an interesting story and your experiences with server code ring a bell which really resonates with me.  Ha, more could be said about...

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

  • Reply To: Splitting a group up into multiple groups using a score....

    Rob Reid-246754 wrote:

    So you think MONEY is a bad column for storing MONETARY values and that an INT which stores PENNIES (CENTS in US), is better. Is there a reason...

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

  • Viewing 15 posts - 676 through 690 (of 1,419 total)