Forum Replies Created

Viewing 15 posts - 1,471 through 1,485 (of 7,619 total)

  • Reply To: column count per table best practice

    Jeff Moden wrote:

    Jeffrey Williams wrote:

    Jeff Moden wrote:

    That's where you and I would differ... to me, the "customer number" would be the IDENTITY column.  Or, perhaps, a Random GUID. 😀  Why would your "customer...

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

  • Reply To: column count per table best practice

    Jeff Moden wrote:

    It would be really interesting to see you design a Customer or Employee table without one.  I'd also be interested in your claim of "it's literally impossible to normalize...

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

  • Reply To: column count per table best practice

    Jeff Moden wrote:

    Heh... so THAT's the reason why so many people end up with "slow databases" and IDENTITY columns everywhere.  😉  A lot of the important stuff isn't even considered up...

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

  • Reply To: column count per table best practice

    Great, sounds good.

    Again, though, your initial design should NOT be "tables", it should just be data.  It should be at a business level, not at a techy level.

    If at 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".

  • Reply To: column count per table best practice

    Ben wrote:

    I want to design a database for an OLTP app where it mainly involves customer and transaction. 

    Then definitely start the design before tables.  That is, do a logical 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".

  • Reply To: value for the max date group by id

    [Use ROW_NUMBER() partly because of inherent efficiency] And partly because it's so easy to adapt:

    SELECT theDate, value, flag
    FROM (
    SELECT *, ROW_NUMBER() OVER(PARTITION BY...

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

  • Reply To: Trouble filling missing months of data with zero values

    DECLARE @start_year int
    DECLARE @start_month char(2)
    DECLARE @month_count smallint
    SET @start_year = 18
    SET @start_month = '01'
    SET @month_count = 12

    ;WITH
    cte_tally10 AS (
    SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
    ),
    cte_tally1000...

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

  • Reply To: isnull returns wrong number of spaces (i think)

    Solution:

    Use COALESCE instead of ISNULL, i.e.:

    select COALESCE(nullif('',''),' ')

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

  • Reply To: Seeking input on Best Method to Join on First or Last Row in a 1:M Join

    jcelko212 32090 wrote:

    After all these decades. I don't remember why the inmate number was that long. I believe we display the first nine digits because that matches the Social Security number....

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

  • Reply To: Cursor inside a transaction

    I just notice this: is there supposed to be a space in the @CustNum value?  Just curious.  Since that appears to be your own custom data type, it might 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".

  • Reply To: Seeking input on Best Method to Join on First or Last Row in a 1:M Join

    Since all the people who have ever existed fit very comfortably into 12 digits, I can't imagine why you'd need 18 digits for your person id.

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

  • Reply To: Cursor inside a transaction

    Interesting behavior.  Have not seen that occur "naturally" before.

    Edit: Now that I think about it, I thought all changes made w/i a trans were visible to that trans, even if...

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

  • Reply To: Server Roles and Permissions

    Atat Rowcount wrote:

    What I need here is a way to grant execute permission to a role, or grant select permission to role, *at a server level*.  Is this impossible?

    Maybe not.  If...

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

  • Reply To: Server Roles and Permissions

    Mr. Brian Gale wrote:

    Lets say in 5 years someone makes a stored procedure that should only be run after hours due to the duration and resource usage.  Since it should only 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".

  • Reply To: Help on aggregation with dates

    If it would be OK to force the NULL value to be added to lowest date:

    ;WITH test_data AS (
    SELECT col1 = 7213
    ...

    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 - 1,471 through 1,485 (of 7,619 total)