• CELKO (10/2/2012)


    >> I have one column that I need split into two, the column holds age value, and the name of the column is age_at_death <<

    TOTALLY WRONG! The age_at_death is a computed value define as

    (death_date – birth_date). Oh, and thanks for the rudeness of no DDL.

    >> There is no space <<

    Of course not! That would mean they you are formatting display data in the query in TOTAL VIOLATION OF A TIERED ARCHITECTURE!! Thisdis a computation:

    DATEDIFF (YY, death_date, birth_date) AS life_span

    >> any suggestions .. <<

    1. Kill the moron that did this and replace all his code. Seriously, a bad programmer will have poisoned so much code, you need to clean it.

    2. Get a minimal education on RDBMS principles. Do you want to be this stupid bastard when you grow up?

    3. Stop programming until you do. You will only hurt people now.

    Good grief Joe, did you forget to take your meds this morning? You complain about the rudeness of the OP, look at your response. Talk about rude!!!

    To the OP: Joe is absolutely correct that this age should be calculated. Storing calculated data is painful to maintain. There are some cases when this "absolute" rule can be broken. Age at death seems like one of those to me. It isn't like the value is ever going to change. 😉

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/