No More NULL

  • You got me all the way to the end. 😛

    I guess the reason I didn't consider that it could be a joke is because of my days working with PeopleSoft in Oracle. NULLs were not allowed in the database. Number fields were zeros and string fields were " " (single space not an empty string) by default. It's been a while, I don't remember what they were doing for default dates.

    I just thought SQL Server was finally going to try and do things the way Oracle has been doing it for years.

    Dave

  • All right! things are going to be so much easier now!

    so when i define a table, i can decide to use my own default ie, "1" for the default value, or i can use the systems default of the default of "0" zero!

    I'm so glad my developers don't have to think any more; it was hard enough training them before.

    I'll call a training session right away so I can untrain them and help them unlearn how to work with nulls.

    by the way, it's too bad I can only trust you all 364 days a year now. or 365 for leap years...whatever.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I too ran the gamut. " the idiots ... wait know why wouldn't that be good?" .. snicker snicker. Thanks Steve.

    Dave62 (4/1/2010)


    my days working with PeopleSoft in Oracle. NULLs were not allowed in the database. ... and do things the way Oracle has been doing it for years.

    FYI: Oracle does not work that way. PeopleSoft might, or it could just have been the implementation at your company.

    <><
    Livin' down on the cube farm. Left, left, then a right.

  • peter.roothans (4/1/2010)


    Hi,

    To NULL or not to NULL. Its perhaps my IQ, but after years I'm still struggling with nulls. I consequently used to implement default values instead of NULLs, just to work around the NULL issues. Now I understand the meaning of NULL as in F=female,M=male, NULL=unknown ...

    In GUI development it's often not described in the functional analysis. The example above I can handle easily with radiobuttons (female/male/unknown) but for other type of fields it's not always that obvious. If I have a blank textbox, should I return NULL or should I return '' to the database ... or should I in all scenarios put an aditional checkbox next to the textbox with the remark "unknown" although that was not specified by the analysists?

    Finally, at this moment I have to write a daily procedure that loops data in a source database and updates specific fields in a destination database. If the matching key is absent in the destination database I insert. I the key exists in the destination, but no longer in the source I (logically) delete the row. In case the matching key exists in both databases I have to update, but only when some fields are changed ... and here I'm struggling again since it seems my approach does not always work ...

    IF EXISTS (SELECT * FROM [dbo].

    WHERE

    = @key

    AND

    (f1 <> @f1

    OR f2 <> @f2

    OR ...)

    BEGIN

    UPDATE ...

    SET modificationdate = getdate(),

    ...

    WHERE = @key

    It's about CASTS, or leading and trailing blancs (LTRIM/RTRIM), etc but also about comparing NULL with NULL or NULL with 0 or ''. So now I'm looking for a best approach to update only when something has really changed without making the error update is not executed while eg NULL has become 0.

    Can someone point me a URL with best approach regarding my need?

    Thanks in advance

    Peter.

    The last time I answered a question about sex the choices were (Y)es (No), (U)nsure.

    IMO NULLS should not be allowed in a database. If the field can be NULL, it's unimportant and not needed anyway. Each field is special and should be treated as such with a valid value. Otherwise, its self-esteem could be hurt and cause troubles in the queries. Then, the field would need counselling and could even start a bad habit like returning NULLS in conditional logic.

  • Arjun-501520 (3/31/2010)


    Brilliant! you had me there for a second.

    The 1/1/1900 was the trigger however. 😛

  • Brilliant Steve!

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

  • I must be more awake than I think. I read the title and my first thought was, "oh yeah, it's 1 April".

    My shoelaces are untied? Thanks! Wait .... 😀

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • i also found myself getting worked up over Microsoft saying "screw standards" yet again.

    Oh, Steve. You get me every year.

  • Ralph Hightower (4/1/2010)


    Ah Steve,

    You had to spoil the joke with a disclaimer.

    Of course, this is also an April Fool's joke and is in no way based on reality. It's entirely a work of fiction, and I hope you have a smile on your face at this point.

    The joke would've been more effective without.

    I'm thinking it might have been better to have had this disclaimer as the first post in the discussion.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • now _that_ was a good one! Good way to start the day! 😛

  • I had to disclaim it at the end. Otherwise I suspect that there would be a lot of broken monitors, and maybe a few calls from MS legal as well. Same for the index one.

    Glad you liked it. Took a little time to figure out what might be a good joke.

  • To quote a young lad: You very funny Doctor Jones! (but really, it was)

  • You totally got me on that one. Very good, very good indeed.:-D

  • You had me going there; while waiting for the forum link to respond was when I got it.

    You might have had fun with a different approach: instead of no NULL, you might have tried 2 types of NULL (NULL, & NIL). A while back I was reading some articles on Codd, his rules, etc and discovered that he wanted to add a second version of NULL. One would represent the absence of data (in the record), and the other would represent the result of a skewed results set (think LEFT JOIN with missing records/fields returned).

    If you had worked something up with that, well you might have caught more people.

    Beer's Law: Absolutum obsoletum
    "if it works it's out-of-date"

  • Yep, you had me going. I'm glad you fessed up before I went running to a coworker with the news. :hehe:

Viewing 15 posts - 31 through 45 (of 105 total)

You must be logged in to reply to this topic. Login to reply