Forum Replies Created

Viewing 15 posts - 256 through 270 (of 1,424 total)

  • Reply To: SQL Query Modification

    This is a tricky query.  You have 2 separate aggregations for which the results are then LEFT JOIN'ed by rank.  What I'm not understanding in my own code is why...

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

  • Reply To: Dirty Reads with Read Committed?

    Does the query contain WITH (NOLOCK)?

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

  • Reply To: Grouping the words which has maximum count

    sathishkm wrote:

    Msg 8144, Level 16, State 3, Line 38 Procedure or function string_split has too many arguments specified.

    Completion time: 2023-05-08T16:53:02.0901322+05:30

    Please run this code and paste the results.  Please replace 'Your-Database-Name'...

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

  • Reply To: Grouping the words which has maximum count

    An alternative

    drop table if exists #title_one_space;
    go
    select * into #title_one_space from (values
    ('one word')
    ,('one word two words')
    ,('one word two words three words')
    ,('one word two words three words four'))...

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

  • Reply To: Peaks and troughs from fluctuating prices

    It shouldn't be necessary to calculate the LAG twice.  Like Drew's code this factors out another CTE

      WITH 
    ctePrev AS
    (--==== Get the previous Prices...

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

  • Reply To: Peaks and troughs from fluctuating prices

    This is interesting.  Nicely done Jeff.  The AI (ChatGPT-4) was unable to make any improvements to the query marked as the solution.  It never comes up with nothing so it...

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

  • Reply To: Peaks and troughs from fluctuating prices

    The prompt was based on minimal code

    this sql code omits a 2nd column with which we could order the rows.  Could you add a date column...

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

  • Reply To: Peaks and troughs from fluctuating prices

    Without a second column containing a date (or some ordinal data type) there's no way to ensure the row ordering is consistent.  Thanks ChatGPT for fixing the data.  You could...

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

  • Reply To: vlookup in range

    No idea what's meant by the rounding.  Presumably (to get the correct output) there's a '<=' inequality.  To handle the range between 174 and 176 you could create a partial...

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

  • Reply To: Are the posted questions getting worse?

    Here in New Jersey USA it's too nice of a day to sit behind a screen!  Spring fever in full effect here 🙂  After my 2 o'clock meeting... adios

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

  • Reply To: Count Number of Records

    water490 wrote:

    I am getting this error.  How do I fix it?

    (573 rows affected)
    Msg 468, Level 16, State 9, Line 14
    Cannot resolve the collation conflict between "Latin1_General_CI_AS" and...

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

  • Reply To: Count Number of Records

    drop table if exists #trades;
    go
    create table #trades(
    underlying_symbol varchar(10) not null,
    trade_date ...

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

  • Reply To: Hierarchy related calculation

    From the tables provided what is the expected result?

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

  • Reply To: How to get top 100 values of a col concatenated in a variable in sqlserver?

    If it were only the 100th row maybe OFFSET paging.  Since it's both the aggregation of the rows as well as the 100th value you could try using ROW_NUMBER in...

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

  • Reply To: Domain Extension Splitting Based on Dot(.)

    Nice one Jeff.  That's a good looking query.  It makes good use of '+'  as the NULL respecting concatenation operator.  My initial thought was to reverse the string and use...

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

Viewing 15 posts - 256 through 270 (of 1,424 total)