Forum Replies Created

Viewing 15 posts - 751 through 765 (of 7,619 total)

  • Reply To: First responders kit - BlitzIndex question

    Wingenious wrote:

    ScottPletcher wrote:

    Wingenious wrote:

    The missing index suggestions are not connected to specific queries in versions prior to SQL Server 2019. SQL Server 2019 added the sys.dm_db_missing_index_group_stats_query DMV. This DMV tells...

    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: First responders kit - BlitzIndex question

    Wingenious wrote:

    The missing index suggestions are not connected to specific queries in versions prior to SQL Server 2019. SQL Server 2019 added the sys.dm_db_missing_index_group_stats_query DMV. This DMV tells you which...

    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: Populate Column Based on Distinct Values

    Kin16 wrote:

    Sorry for the confusion. Yes, as the data stands right now the entire column should be populated with an *. If the department column included 0001 and 0002, then...

    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: Populate Column Based on Distinct Values

    I'm not really sure what you're trying to do, but it sounds like something like this:

    UPDATE tn
    SET tn.[Export Deparment] = CASE WHEN Distinct_Department_Count = 1 THEN '*'...

    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: Incorrect syntax near the keyword end

    Also, since the table you are INSERTing to already exists, you need to INSERT to it, not SELECT ... INTO it:

    Truncate TABLE Planning

    Insert Into Planning
    Select *

    from (select...

    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: Quick SQL challenges for mid-experienced+ DBAs (and advanced T-SQLers)

    (2) Here's my answer:

    CREATE TABLE dbo.emp_training ( id int IDENTITY(1, 1) NOT NULL, emp_id int NOT NULL, training_id int NOT NULL, status char(1) NULL CHECK(status IN ('F',...

    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 retrieve information after second occurrence of a character

    Here's an alternative:

    SELECT E.*, LEFT(ds.Item, CHARINDEX(')', ds.Item + ')') - 1) AS Invoice
    FROM @ErrList E
    CROSS APPLY (SELECT Item FROM dbo.DelimitedSplit8K(ErrDesc, '(') WHERE ItemNumber = 3) AS ds

    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: First responders kit - BlitzIndex question

    Grant Fritchey wrote:

    ScottPletcher wrote:

    Grant Fritchey wrote:

    On the missing index views? They just don't say anything. I'm not talking about all the other DMVs. They're vital. 1 million percent so. But the missing...

    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: Quick SQL challenges for mid-experienced+ DBAs (and advanced T-SQLers)

    Yeah, Cost Threshold for Parallelism is way too low.  That is likely causing the crazy spikes in response/CPU times.

    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: First responders kit - BlitzIndex question

    Grant Fritchey wrote:

    On the missing index views? They just don't say anything. I'm not talking about all the other DMVs. They're vital. 1 million percent so. But the missing index DMVs?...

    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: Quick SQL challenges for mid-experienced+ DBAs (and advanced T-SQLers)

    I wonder what Jonathan's parallelism settings are, and other SQL settings that might affect the run times.  Some of those results are definitely out of place.

    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: First responders kit - BlitzIndex question

    Grant Fritchey wrote:

    Generally speaking, the missing index recommendations taken from the DMV tables are useless. That's because they are not, and cannot be, linked to a given query. So you just...

    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: Quick SQL challenges for mid-experienced+ DBAs (and advanced T-SQLers)

    Jonathan AC Roberts wrote:

    Jeff Moden wrote:

    For Question #1, Scott's method is the fastest.  Don't take my word for it, though. 

    These are the results from my machine

    ***********************************************************************************************************************
    ===== Scott's Code) =====
    DBCC...

    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: Quick SQL challenges for mid-experienced+ DBAs (and advanced T-SQLers)

    I'm curious to see if anyone takes a shot at (2).  Maybe it's TL;DR :smile:.

    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: Group by column over partition ordered by date

    ;WITH cte_add_row_num AS (
    SELECT *, ROW_NUMBER() OVER(PARTITION BY Itinerary ORDER BY CreationDate) AS row_num
    FROM dbo.Test
    )
    SELECT T.*
    FROM dbo.Test T
    INNER JOIN...

    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 - 751 through 765 (of 7,619 total)