• dndaughtery (10/28/2013)


    what I want to do is based on the value from ProjectedTimeTill100PercentSellThrough, in each record I want to update the bit fields.

    For example if I have the following row:

    ProjectedTimeTill100PercentSellThrough SellThrough1Hour SellThrough2Hour SellThrough3Hour SellThrough4Hour

    65 0 0 0 0

    The ProjectedTimeTill100PercentSellThrough is in minutes. I want an update that will go through every column and set its SellThrough1Hour, SellThrough2Hour, SellThrough3Hour, and SellThrough4Hour to a 1 or 0 depending if the minutes falls in the range. So the above would result in the following:

    ProjectedTimeTill100PercentSellThrough SellThrough1Hour SellThrough2Hour SellThrough3Hour SellThrough4Hour

    65 0 1 1 1

    How about some ddl and sample data?

    I have to admit that I can't even begin to understand what the logic is supposed to be here. Some explanation of how the calculation should work would help greatly.

    _______________________________________________________________

    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/