Forum Replies Created

Viewing 15 posts - 3,256 through 3,270 (of 7,619 total)

  • RE: Can I pull DISTINCT customers with SQL based on most recent row record only?

    Lynn Pettis - Tuesday, July 24, 2018 11:26 AM

    Jonathan AC Roberts - Tuesday, July 24, 2018 11:02...

    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".

  • RE: Can I pull DISTINCT customers with SQL based on most recent row record only?

    Jonathan AC Roberts - Tuesday, July 24, 2018 11:02 AM

    I don't think creating and index with that column desc would help performance, at...

    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".

  • RE: Can I pull DISTINCT customers with SQL based on most recent row record only?

    The imperfect index definition is a drag on the first query, requiring a sort of all rows.  Correcting the index definition:

    DROP INDEX IX_latestrecords_1 ON latestrecords;
    CREATE UNIQUE INDEX...

    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".

  • RE: Table Redesign Question

    Not enough details to get specific, but in very general terms, I would likely go with a new option.

    Keep the existing tables to do the current logging, but...

    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".

  • RE: How to Get Peformance Counters Programmatically for One Dynamic SQL Statement

    Consider using system views such as sys.dm_db_index_operational_stats. Presumably you know at least the db(s) in which the code operates, although hopefully object names as well (or at least most...

    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".

  • RE: Keep only the true changes in a massive table

    Wouldn't you want to do that the other way?  That is, find rows where the previous row matches the next row -- i.e. no column changed -- so you could...

    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".

  • RE: Seeking advice to determine a good option for table row comparisons

    Use MS's free tool "tablediff.exe" and let them do this work for you, and fully tested already!  Unfortunately quirky to get working initially, but works well after that, and it's...

    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".

  • RE: Sorting and Grouping problem

    I didn't have any data to test with, but I'm reasonably sure my sort order is correct.  As I think you've since discovered, the rows get out of order outside...

    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".

  • RE: Sorting and Grouping problem


    ;WITH cte_EarliestShowDates AS (
      SELECT Show, MIN(Date) AS EarliestShowDate
      FROM dbo.TableName
      GROUP BY Show
    )
    SELECT TN.*
    FROM dbo.TableName TN
    INNER JOIN cte_EarliestShowDates CESD...

    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".

  • RE: How to improve Delete Performance

    quinn.jay - Tuesday, July 17, 2018 12:43 PM

    I ended up going with a tweak on the DELETE statement coupled with clustered and...

    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".

  • RE: How to improve Delete Performance

    right now deletes the current and previous month, where the table holds 2.5 yrs of data. These tables currently do not have any keys, constraints o[r] indexes. 

    Cluster...

    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".

  • RE: DBCC Shrinkfile not shrinking Data File

    When you add the keyword, you're probably preventing the physical shrinking.  If you really want to shrink, just shrink:

    DBCC SHRINKFILE (N'prod1', 0)

    I wouldn't use 0 personally...

    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".

  • RE: Left(null,5) 'anything' is not true?

    set ansi_nulls off 
    I'm trying to find a way to avoid having to use isnull() or coalesce() everywhere in my script in order to avoid counterintuitive null comparison results...

    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".

  • RE: Accurate Estimations, But Hash Match Aggregate Spilling to TempDB

    chris.o.smith - Monday, July 16, 2018 7:23 AM

    Thanks for the responses, and sorry for the delay - the responses came in...

    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".

  • RE: Validate whether at least 1 record per user is marked as primary

    I swear I posted this already (somewhere at least!, another SQL help site perhaps?), but I'll post it here too just in case:


    SELECT EmployeeInformationID, COUNT(*)...

    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 - 3,256 through 3,270 (of 7,619 total)