Forum Replies Created

Viewing 15 posts - 3,526 through 3,540 (of 7,613 total)

  • RE: Query to increment an alpha character suffix

    I have a little more time today, corrected version below. 
    The cte is to (1) make it easier to use in a function and (2) to make it easier...

    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: Calculating Age - Keep it simple

    curt 27476 - Tuesday, February 27, 2018 10:12 AM

    ScottPletcher - Tuesday, February 27, 2018 9:16 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: Calculating Age - Keep it simple

    As usual with age, leap year birthdays are the deciding factor.

    If someone was born on Feb 29, 2004, how old are they on Feb 28, 2018?  In your...

    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: Triggers

    No.  In fact, generally they are a bit faster since you don't have to decide within the trigger which action -- DELETE / INSERT / UPDATE -- has occurred.

    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: Question about a composite key and autoincrement

    Does is really matter if the numbers are sequential or is everyone just used to that?

    If it doesn't really matter, you might just use an identity column 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: Query to increment an alpha character suffix

    I prefer this alternative.  Not for performance reasons, mostly that it allows easier customization of the suffix chars to be assigned.  Sometimes certain chars, such as I and O, are...

    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: Update the first and last 2 charactors with year and month

    Oops, correction:


    UPDATE [EC_StoreAttributes]

      SET AttributeValue = CONVERT(varchar(2), GETDATE(), 12) -- 112)112) + /* 12 rather than 112 */
       SUBSTRING(AttributeValue, 3, LEN(AttributeValue)...

    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: SQL uses 2 different executions plan (slow and fast) for a simple query. Need a new index ?

    Based on your last comments, this looks like the only way that might really help.  Your keys columns are exceptionally non-selective, which makes it more difficult to get best performance.

    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: Is there a row locking similar to Oracle's row locking in SQL SERVER 2016

    nickosl50 - Friday, February 23, 2018 11:17 PM

    The numbers given to invoices entered by the users must be unique and also with...

    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: Issues with Update using Cross Apply


    UPDATE t
    SET response_sol_id = x.[solicitation_id]
    FROM #temp_stp t
     CROSS apply (SELECT P.solicitation_id
       FROM [SOLICIT].[gtm_doc_prod] P
       INNER JOIN [SOLICIT].[gtm_doc]...

    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: SQL uses 2 different executions plan (slow and fast) for a simple query. Need a new index ?

    Again, you need to cluster the table on those columns then.  You can adjust nonclus indexes all day and it most often won't do you much good.

    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: Is there a row locking similar to Oracle's row locking in SQL SERVER 2016

    Yes, there is.  It's called "SNAPSHOT ISOLATION".  That's almost exactly like Oracle: point-in-time for SELECTs, version rows stored to handle long-running queries, readers don't block writers, writers don't block readers,...

    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: SQL uses 2 different executions plan (slow and fast) for a simple query. Need a new index ?

    Hard to tell without selectivity / row count info, as Chris noted.

    But, if the partition and dataareaid are how you typically query this table, and guessing that PARTITION...

    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: Update the first and last 2 charactors with year and month


    UPDATE [EC_StoreAttributes]

        SET AttributeValue = CONVERT(varchar(2), GETDATE(), 112) +
            SUBSTRING(AttributeValue, 3, LEN(AttributeValue) - 4) +
           ...

    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: Redesign Questions

    Start fresh with a new db design!

    Do a true logical design -- without NO carryover from current design and NO consideration of physical implementation (Oracle, SQL, etc.).  NONE. ...

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