Forum Replies Created

Viewing 15 posts - 7,141 through 7,155 (of 7,613 total)

  • RE: UNIQUEIDENTIFIER vs BIGINT

    Eugene Elutin (10/4/2012)


    ScottPletcher (10/4/2012)


    I don't think such extremely simplistic rules always work well in tables, large or small.

    Choosing the best indexes takes a lot of careful consideration of your 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: t-sql - days to week and days

    Jeff Moden (10/3/2012)


    sqlserver12345 (10/2/2012)


    How do I convert days into weeks and days

    Ex:350 days = 50 0/7 weeks

    351 days = 50 1/7 weeks

    352...

    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: UNIQUEIDENTIFIER vs BIGINT

    Jeff Moden (10/3/2012)


    ScottPletcher (10/3/2012)


    Determing the appropriate column actually takes analysis; again, there is no one-rule-fits-all-tables for the best clustered key column.

    Customer ids are usually unique and ever-increasing; narrowness is sometimes...

    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: UNIQUEIDENTIFIER vs BIGINT

    Jeff Moden (10/3/2012)


    Use the clustered index for a more appropriate column

    For large tables, the "appropriate column" is usually unique, narrow, and ever-increasing. "Customer Code" columns almost never meet all...

    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: t-sql - days to week and days

    --

    --

    SELECT

    col1, col2, days,

    CAST(days / 7 AS varchar(5)) + ' ' + CAST(days % 7 AS varchar(1)) + '/7' AS weekdays

    FROM...

    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: Database change policy and procedure

    Backup and restore requests.

    I've done away with a lot of the "requests" -- just provide 'em a stored proc that can be run to do the backup. The stored...

    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: Running out of Identity values

    Eugene Elutin (10/3/2012)


    ScottPletcher (10/3/2012)

    ...

    Why would the relative position of the column make the slightest bit of difference at all?

    It may effect page splits and re-writes.

    ?? How is that??

    Fixed-length 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: Get the overall status of a particular product

    An uncontrolled MIN() could fail as other Statuses appear in the table.

    I suggest directly coding for the specific condition you are looking for:

    SELECT

    Product,

    ...

    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 can I find the first column having NULL values in a table

    In this case ;-), I think a simple CASE will do exactly the same thing:

    SELECT TOP 1

    CASE WHEN Col1 IS NULL THEN 1 WHEN...

    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: My 3 year old desktop SQL Server outperforms my spanking new SQL Server !

    Along those lines, make sure the statistics are up to date on the tables on the server as well.

    Also, a quick checklist of a few things to look at 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: Database change policy and procedure

    Actually, Brendan, what you're described is what I've seen over and over.

    While well intentioned, such processes usually end up being roadblocks rather than welcome centers (to stay with the road...

    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: Running out of Identity values

    So I guess there's no issue with rows being UPDATEd / DELETEd while the new table is being created?

    Or with the potential lock outs/delays to current modifications during the export...

    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: TSQL Case Statement help

    ChrisM@Work (10/3/2012)


    ScottPletcher (10/2/2012)


    SQL Server is optimized to do table lookups, whereas CASE statements are comparatively very slow.

    Therefore, I suggest using a lookup table, as suggested by others. You absolutely...

    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: Get multiple rows of data based on one condition and grouping

    Eugene Elutin (10/2/2012)


    ...

    Given that a customer's name can change, perhaps it is an attribute of the purchase.

    ...

    Given that nothing in the Universe is constant and everything can change,...

    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: UNIQUEIDENTIFIER vs BIGINT

    Typically customer codes are sequential. Since they're not here, that would definitely make the clustering key choice much more difficult.

    If customer code is (almost) always used for lookups/processing, you...

    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,141 through 7,155 (of 7,613 total)