Forum Replies Created

Viewing 15 posts - 3,916 through 3,930 (of 7,619 total)

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

  • RE: Trigger help

    Yes, the "SET NOCOUNT ON" should be w/i the trigger code itself:


    CREATE TRIGGER trEMCondition_INSERT
    ON dbo.vEMLocationHistory
    AFTER INSERT
    AS
    SET NOCOUNT ON;
    UPDATE e

    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: Manipulate two columns of information into one column for each type of data.

    I'd have to see the specific code, but it appears the GROUP BY is not complete/correct:

    SELECT
    ID, NAME,
    MAX(CASE WHEN TestType.id = 1 THEN Testing.score END) AS Reading,

    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

    More than 50% of the time, identity is the wrong clustering key, because there's another column(s) that is(are) more valuable overall as the one and only clustering key. The single...

    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

    Or this:


    SELECT FirstDate, SecondDate, ExpectedResult,
    ABS(DATEDIFF(year, FirstDate, SecondDate)) as CurrentMethod,
    CASE WHEN SecondDate >= FirstDate THEN
      CASE WHEN (DATEPART(MONTH, SecondDate)...

    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: Manipulate two columns of information into one column for each type of data.

    As below.  Or, if you need to show blanks rather than NULLs, then:
    ISNULL(CAST(MAX(CASE WHEN TestType.id = 1 THEN Testing.score END) AS varchar(4)), '') AS Reading,
    etc.

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

  • RE: QueryOptimization

    You don't need an identity column on this table: it just corrupts the table design and performance (and is a moderate waste of disk and RAM as well).  There really...

    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: Whitespace in 3-part name ignored???

    RonKyle - Wednesday, March 8, 2017 1:48 PM

    I would never name a column 'authorization'. It would be something...

    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: Whitespace in 3-part name ignored???

    Eric M Russell - Wednesday, March 8, 2017 1:16 PM

    I would never name a column 'authorization'. It would be something like 'AuthorizationDate'...

    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: Whitespace in 3-part name ignored???

    RonKyle - Wednesday, March 8, 2017 12:10 PM

      If that happens to be a reserved word, so be it. 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".

Viewing 15 posts - 3,916 through 3,930 (of 7,619 total)