Forum Replies Created

Viewing 15 posts - 3,901 through 3,915 (of 7,613 total)

  • RE: Encapsulating complex logic without using a scalar UDF

    Jeff Moden - Wednesday, March 15, 2017 6:21 PM

    The single update on a calendar table to renumber the working day enumerations is...

    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: Covering Index

    A covering index is an index that has all the columns needed to satisfy, or "cover", a given query.

    For example, say I have a table with 20 columns,...

    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: Differences in this where statement

    1) You didn't strip the time.
    2) You need to use < the ending day, rather than <=

    For example:

    I've changed it to:
    (DateAttribute >= DATEADD(DAY,-10,CAST(GETDATE() AS...

    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: Clustered scan vs Non-clustered Seek with lookup

    Since you already have an identity column, go ahead and add that to make the clustering unique.  SQL would "uniquify" it, but it's better to do it yourself to avoid...

    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: Clustered scan vs Non-clustered Seek with lookup

    Jeff Moden - Tuesday, March 14, 2017 11:32 AM

    I'd make sure that col1 is immutable, unique, and ever-increasing or there will be...

    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: Encapsulating complex logic without using a scalar UDF

    jcelko212 32090 - Tuesday, March 14, 2017 11:31 AM

    ScottPletcher - Monday, March 13, 2017 11:45 AM

    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: Clustered scan vs Non-clustered Seek with lookup

    Change the clustering index to the 2 columns that are used most often / nearly always as predicates.  If you prefer, you can add a unique column as a 3rd...

    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: Need Correct Index for slow query

    Some things to consider:

    Typically you'll most likely access these rows by datetime range.  I'm guessing the actual query might even have such a date restriction, or, if it...

    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: Encapsulating complex logic without using a scalar UDF

    jcelko212 32090 - Monday, March 13, 2017 11:17 AM

    Jeff Moden - Saturday, March 11, 2017 8:42 PM

    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: Encapsulating complex logic without using a scalar UDF

    jcelko212 32090 - Friday, March 10, 2017 12:40 PM

    sgmunson - Friday, March 10, 2017 12:14 PM

    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: Encapsulating complex logic without using a scalar UDF

    jcelko212 32090 - Thursday, March 9, 2017 3:35 PM

    ...In this case, I would use big look up table. A date is...

    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 overcome the identity column "jump 1000" issue

    Jeff Moden - Thursday, March 9, 2017 7:51 PM

    Yep... me too, Scott.  Decades of experience.  Just, apparently, different experience and that's 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".

  • RE: How to overcome the identity column "jump 1000" issue

    Eric M Russell - Friday, March 10, 2017 6:38 AM

    GilaMonster - Friday, March 10, 2017 12:01 AM

    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 overcome the identity column "jump 1000" issue

    Jeff Moden - Thursday, March 9, 2017 4:17 PM

    ScottPletcher - Thursday, March 9, 2017 11:53 AM

    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: Encapsulating complex logic without using a scalar UDF

    Wow, that's a huge amount of code.  Does it do something better than the code I posted earlier?:


    SELECT DT.*,
        DATEDIFF(YEAR, LowDate, HighDate) - CASE...

    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,901 through 3,915 (of 7,613 total)