Forum Replies Created

Viewing 15 posts - 136 through 150 (of 1,414 total)

  • Reply To: row changes per hour by TagID

    Bruin wrote:

    Looks like if I add this in my query logic I'm getting the datetime desired

    DATEADD(s,t_stamp/1000,'1969-12-31 20:00:00')

    2024-02-01 01:00:00.000 2024-02-01 01:00:01.000

    Struggle with doing the count of records per TagID within the...

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

  • Reply To: row changes per hour by TagID

    Bruin wrote:

    CREATE TABLE [dbo].[tmp_sqlt_data_1_2022_05](
    [tagid] [int] NOT NULL,
    [intvalue] [bigint] NULL,
    [floatvalue] [float] NULL,
    [stringvalue] [nvarchar](255) NULL,
    [datevalue] [datetime] NULL,
    [dataintegrity] [int] NULL,
    [t_stamp] [bigint] NOT NULL,
    PRIMARY KEY CLUSTERED
    (
    [tagid] ASC,
    [t_stamp] ASC
    )WITH (PAD_INDEX =...

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

  • Reply To: SQL query i need each Friday count back 6 days and select each ticker record

    angang wrote:

    I need to be able to read the previous 5 Friday dates...

    A good place to start could be with a query to generate the most recent 5 Friday dates...

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

  • Reply To: Add inf a currency symbol to a calculated column

    Here are two ways.  My preference is for the second one.  Since the FORMAT function was introduced in SQL Server 2012 (afaik) it's been known to have performance issues.  Maybe...

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

  • Reply To: How to get Active counts between dates. Please

    Jeff Moden wrote:

    IMHO, Steve Collins' post (with a tiny tweak (change fn.n to fn.value) in the 2nd bit of code) contains the winning entries for simplicity IF you don't mind any...

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

  • Reply To: How to get Active counts between dates. Please

    Using a tally function or GENERATE_SERIES maybe something like this

    /* expand the date range using a tally function */
    select v.calc_dt, count(*) active_policies
    from #Policy p
    ...

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

  • Reply To: Writing SQL Server code with AI using GitHub Copilot

    A while ago when I looked into GitHub Copilot, the service was based on ChatGPT-3.5 which is/was quite inferior imo to the ChatGPT-4 which was available at the time. 

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

  • Reply To: Do You Have a Jeff?

    Back in the day, before SQL Server 2012 was previewed, I worked on a project which started with a blank database.  My teammate at the time started sending me articles...

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

  • Reply To: How to substract value from its own column in same tabl through condition basis

    We'll have to see how the OP replies.  Maybe my code only summed the part they want subtracted from the sum_qty

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

  • Reply To: How to substract value from its own column in same tabl through condition basis

    All right, some data.  This could be my only chance to use SQL for the day.  For my part, this week and until it's done, I'm working on web development. ...

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

  • Reply To: Finding strings with invalid characters

    That old function could use an updating imo.  As this is the 2022 topic GENERATE_SERIES and STRING_AGG are available.  Also, not to say it's incorrect but...

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

  • Reply To: Combine rows into pivoted output

    To make the selection criteria specific to each column you could try a conditional aggregation approach to pivoting the data

    select TestID,
    ...

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

  • Reply To: Has AI Changed Software Development?

    This question still has me thinking.  How has development changed because of AI?  There's more than one trend happening at once imo.  For SQL the impact for me has been...

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

  • Reply To: Inconsistent query execution times

    MrBen wrote:

    Thanks alot guys, I think I've taken a bit from each of the 3 posts and have made progress. I've posted the new execution plan below. Seems to be...

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

  • Reply To: Inconsistent query execution times

    Disclaimer: this contains speculation and opinions

    In broad terms, when considering performance, imo it makes sense to overlay the FROM clause with the execution plan.  The FROM clause is read left-to-right...

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

Viewing 15 posts - 136 through 150 (of 1,414 total)