Forum Replies Created

Viewing 15 posts - 616 through 630 (of 1,413 total)

  • Reply To: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    The issue with parsing is there are 6 different delimiters (including 'Supervisor') when you really only need 1.  With 1 delimiter an ordinal splitter (which is based on a tally...

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

  • Reply To: Get the last day of the year based on a date range

    It's the same idea with a clock as with a calendar

    https://www.sqlservercentral.com/forums/topic/get-total-no-of-minutes-by-hour-hand-between-two-dates#post-3900058

     

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

  • Reply To: Briefcase no working?

    It appears spacing within certain code blocks have been removed.  It appears to be retroactive across history too.

    In my most recent response the spaces in the results code block appear...

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

  • Reply To: Get the last day of the year based on a date range

    "...is it possible to determine the number of years to be able to iterate them and in each turn set the new dates?"

    To determine the number of years "to iterate"...

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

  • Reply To: Put two queries together

    Maybe this

    SELECT D.DocumentID AS [Document ID], D.Filename AS [Document Filename], 
    XR.XRefDocument As [Child Document ID], D2.Filename AS [Child Filename],
    ...

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

  • Reply To: How to extract date from a long string

    Maybe it's better to nest PATINDEX functions instead of reversing the string(s)

    declare
    @srch varchar(100)='%[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]%';

    /*...

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

  • Reply To: How to extract date from a long string

    This can be a bit of a pita.  It helps greatly if there is one and only one acceptable date format, like YYYY-MM-DD (padded with zeros).  Another issue is what...

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

  • Reply To: Insert if not exist

    "How can I insert as zero amount if not exist in my working table?"

    It seems maybe you're looking to LEFT JOIN the two tables together.   Obviously, you cannot assign attributes...

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

  • Reply To: Find gaps in string values within a table

    Maybe something like this.  I added some additional example rows.  It's similar to this other post imo.

    insert #temp_docs(BegVal, EndVal, Volume, Prefix, Padding, begnum, endnum) values
    ('ABC000063738', 'ABC000063738',...

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

  • Reply To: Find gaps in string values within a table

    Similar to Jeffrey's answer

    with lead_cte as (
    select *, lead(begnum) over (partition by Prefix order by begnum) lead_bn
    from #temp_docs)
    select concat(lc.Prefix,...

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

  • Reply To: Having a hard time with time zones

    You could try it like this

    DECLARE @CallDateTime DATETIME = '20190331 00:08:13'
    DECLARE @Duration NVARCHAR(25) = '01:18:04'

    declare @t datetime=@duration;
    select @t+@CallDateTime...

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

  • Reply To: SCUD?

    It could be CRUD but only when implemented by Scrum.  Or maybe it's a framework which launches projects miles over the horizon where they explode.

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

  • Reply To: How to get total only for today's date for some columns in reslut set

    You could try putting CASE logic inside the SUM functions to evaluate your youdatecol

    ...
    ISNULL(SUM(case when youdatecol>=convert(date, getdate())
    ...

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

  • Reply To: Split column values to multiple rows

    ;with
    id_split_person_cte(id, [Owner], ItemNumber, [PersonAttending]) as (
    select sctr.id, sctr.[Owner], splt_person.ItemNumber, splt_person.Item
    from #SplitColumnsToRows sctr
    ...

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

  • Reply To: Split column values to multiple rows

    Got any more examples?  It appears there are 2 sets of rules for the 2 different scenarios:

    Scenario 1) Owner='' -----> (if [Owner]='' then PersonAttending and Type columns are CROSS JOIN'ed)

    Scenario...

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

Viewing 15 posts - 616 through 630 (of 1,413 total)