Forum Replies Created

Viewing 15 posts - 7,246 through 7,260 (of 7,619 total)

  • RE: Check that a specific Group By condition does not exist

    Lynn Pettis (9/7/2012)


    The real test will be against a 1,000,000 (or so) table. I will try and set up such a test tonight at home. One of 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: Order by a column keeping the families together

    1. Columns are fields!

    Technically they are not.

    But in practice, many people refer to SQL columns as "fields", so you just have to accept that and move on.

    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: Datatype truncation

    Why does the float value change to a smaller number when the precision increases?

    Maybe just the general nature of floating point values, that they are approximations only.

    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: Datatype truncation

    I am completely unable to get the float value to cast or convert to a varchar and not truncate it

    From BOL:

    "By default, the precision of built-in operations on float 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".

  • RE: Check that a specific Group By condition does not exist

    Lynn Pettis (9/7/2012)


    You may want to compare the execution plans between the two solutions provided:

    CREATE TABLE #tblTemplates

    (

    ...

    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: Check that a specific Group By condition does not exist

    SELECT TemplateID

    FROM #tblBlocks

    GROUP BY TemplateID

    HAVING COUNT(DISTINCT CASE WHEN #tblBlocks.BaseStage = 1 THEN BlockID END) = COUNT(DISTINCT BlockID)

    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: Check that a specific Group By condition does not exist

    sku370870 (9/7/2012)


    SELECT Distinct #tblTemplates.TemplateName FROM #tblTemplates

    INNER JOIN #tblBlocks ON #tblTemplates.TemplateID = #tblBlocks.TemplateID

    INNER JOIN (SELECT TemplateID, BlockID

    ...

    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: Time as a high precision difference of dates

    TimeResult1 = -- ChrisR (5 date functions, 2 datatype conversions)

    TimeResult2 = -- ChrisM (5 date functions, 2 datatype conversions)

    ...

    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: Check that a specific Group By condition does not exist

    SELECT BlockID

    FROM #tblBlocks

    GROUP BY BlockID

    HAVING MAX(CASE WHEN BaseStage = 1 THEN 1 ELSE 0 END) = 0

    Include the TemplateID in the SELECT and GROUP BY if required.

    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: Time as a high precision difference of dates

    bmahf (9/6/2012)


    So it turns out that each of these solutions is missing something, it's either the fraction part sometimes comes out incorrect, because it wasn't adjusted as I was doing...

    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: Time as a high precision difference of dates

    Lynn Pettis (9/6/2012)


    Steven Willis (9/6/2012)


    ScottPletcher (9/6/2012)


    return an INT value, which at a precision level of 7 gets overflowed.

    The INT can't overflow returning billionths of a second -- the max possible...

    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: Time as a high precision difference of dates

    return an INT value, which at a precision level of 7 gets overflowed.

    The INT can't overflow returning billionths of a second -- the max possible value is 999,999,999, which 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: Please Help on Trailing spaces

    Jeff Moden (9/6/2012)


    ScottPletcher (9/6/2012)


    I don't think audit triggers are relevant any more, given the better options built into SQL itself now.

    I've not found those options to do so well.

    Interesting. ...

    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: Please Help on Trailing spaces

    Jeff Moden (9/6/2012)


    I guess the trigger method for cleaning up new data would be ok but that places an insert tax on the system. I'd prefer not to do...

    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: Please Help on Trailing spaces

    It doesn't need a trigger because the data doesn't change, it just needs to be cleaned up.

    But the trigger DOES the clean up, which guarantees that (1) it occurs 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".

Viewing 15 posts - 7,246 through 7,260 (of 7,619 total)