Forum Replies Created

Viewing 15 posts - 4,396 through 4,410 (of 7,613 total)

  • RE: Database Design Follies: NULL vs. NOT NULL

    kenambrose (2/29/2016)


    [[You'll have up to 8 bits to designate just "how" the data is missing. You certainly do NOT want to store 'TBD' | 'NA' | etc. in any column(s).]]

    Oh...

    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 Design Follies: NULL vs. NOT NULL

    If you want to use TBD/NA/etc., you might as well just a one-byte status column. You'll have up to 8 bits to designate just "how" the data is missing....

    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: Global temp table usage

    I prefer to create those types of tables in the tempdb simply because that makes them less overall overhead on the SQL instance, because of the optimizations available only in...

    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: Global temp table usage

    If it's 128 bytes or less, use CONTEXT_INFO(). That will persist for the life of the connection.

    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 Design Follies: NULL vs. NOT NULL

    kenambrose (2/29/2016)


    [[ non identity ]]

    the relational term for that is "natural key".

    I would never design a table structure without one. There ALWAYS is one, and if no-one can say...

    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 Design Follies: NULL vs. NOT NULL

    j-1064772 (2/26/2016)


    That doesn't get rid of NULLs. You'd have to LEFT JOIN to the other tables ... which produces NULL if you don't find a match!

    Well you can always...

    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 Design Follies: NULL vs. NOT NULL

    j-1064772 (2/26/2016)


    kenambrose (2/26/2016)


    it's actually pretty easy to work with an absolute ban.

    You just take any column where you would otherwise need nulls, and make a related table for it 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: Database Design Follies: NULL vs. NOT NULL

    roger.plowman (2/26/2016)


    j-1064772 (2/26/2016)


    roger.plowman (2/26/2016)


    j-1064772 (2/26/2016)


    Otherwise how do you publish the information if no field can be left NULL ? Real life cannot be constrained by database design requirements. Life 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: Database Design Follies: NULL vs. NOT NULL

    patrickmcginnis59 10839 (2/26/2016)


    ScottPletcher (5/21/2015)


    JediSQL (10/31/2014)

    In most conditional statements, like WHERE clauses and IF statements, the conditional expression will return TRUE if and only if SQL Server considers the assertion provably...

    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 Design Follies: NULL vs. NOT NULL

    kenambrose (2/26/2016)


    there is another very negative consequence of allowing nulls. It is a different kind of performance problem, but a very real one in my experience. You may...

    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: Crazy CASE statement causing major churn on WorkTable

    Btw, you really should strongly consider using ints to represent the StoreNumber and MerchantNumber -- the typical StoreNumberId and MerchantNumberId -- and looking up the 25-byte strings from a separate...

    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: Crazy CASE statement causing major churn on WorkTable

    Do you (almost) always access this table by StoreNumber and MerchantNumber? If so, cluster the table on those columns -- using the code below -- and try again. ...

    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 Help

    pietlinden (2/24/2016)


    I did mine differently. I checked for existence of both class types in the "attends" table...

    CREATE TABLE Student(

    StudentID INT IDENTITY PRIMARY KEY,

    FirstName VARCHAR(10) NOT NULL,

    LastName VARCHAR(15) NOT NULL

    );

    GO

    INSERT...

    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: Data Model Design Assistance

    Are the blocks specific to one issue or "shared" across issues? For now, I'll assume that Block is a completely independent entity. [If it's not, we'll need to...

    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: table design

    hlsc1983 (2/24/2016)


    i meant to write like this: exam_year int,

    The reason why i am using exam_year is because the marksheet that the system must finally print reads something like this:...

    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 - 4,396 through 4,410 (of 7,613 total)