Forum Replies Created

Viewing 15 posts - 1,021 through 1,035 (of 7,613 total)

  • Reply To: How to calculate delta in timestamp

    Jeff Moden wrote:

    ScottPletcher wrote:

    It doesn't matter if the 'on' is followed by 'on' or 'off', just add up all the 'on' times.

    It actually does matter because two on times without an...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Slow Query

    Grant Fritchey wrote:

    If Member_MRN_lkupAllMBRNOs is a multi-statement table-valued user-defined function, that alone is going to cause pretty massive performance heads. Either switch it to being an in-line function, or eliminate the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How to calculate delta in timestamp

    It doesn't matter if the 'on' is followed by 'on' or 'off', just add up all the 'on' times.

    ;WITH cte_switches_with_next_time AS (
    SELECT friendlyName,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Get over 500,000 records into a table

    I provided the exact command to do that in my earlier code.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Get over 500,000 records into a table

    That's a lot of images at one time.  I suggest starting at 10K or even 5K and see how that goes first.

    Btw, be sure to use sp_tableoption before UPDATEing the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: SUM(CAST(....

    I kinda wondered why the column data needed to have 'MB' in it when the column name said 'MB'?!

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: sql query help

    STRING_AGG is not available in SQL Server 2016.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Too many .ldf

    SQL will separately use each one in order as the previous one gets full.  That is, only one log file per db is ever used at one time.  Unlike data...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Last Successful TLog Backup (Hr) Help

    I'm not exactly sure what result you want, but if you want only a single result you need to add an ORDER BY to the query.  A TOP (1) without...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: left join causing results to be multiplied

    Using a sub-SELECT should help, even if the main "table" is actually a view.

    SELECT job_op.seq, job_op.description, job_op.part, job_op.router, job_op.router_seq, 
    (SELECT /*TOP (1)*/ job_op_wc.workcenter...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Need to bring in all combinations from the data

    Just off the top of my head, here's on way:

    DROP TABLE IF EXISTS #RELATIONSHIP_FLATTENED;
    SELECT TOP (0) [CASE], INDIVIDUALID AS ID
    INTO #RELATIONSHIP_FLATTENED
    FROM RELATIONSHIP
    --
    CREATE UNIQUE CLUSTERED INDEX [RELATIONSHIP_FLATTENED__CL]
    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Get over 500,000 records into a table

    Did you pre-allocate enough log space to handle the entire insert?

    I had a load task that took 4+ hours.  I noticed the initial log size was very small.  After I...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How to reclaim space from a table

    What "index maintenance" do you perform on the heap?!

    I think a REBUILD should release unused space from a heap.  REBUILD is just:

    ALTER TABLE <your_table_name_here> REBUILD;

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Get over 500,000 records into a table

    That load query is fairly straightforward.  I think SQL should be able to write output as it is generated, reducing memory requirements.  Would have to see the query plan to...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: sql query help

    I think this will help ( but maybe not?! 🙂 ).  What I sometimes do is rather than using fully dynamic SQL, I use placeholder column names and then rename...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 1,021 through 1,035 (of 7,613 total)