On Nov 16, 2007 4:07 PM, John Gunvaldson <[EMAIL PROTECTED]> wrote: > > >>>> > It's just that "elegance" makes it difficult for us hackers to > understand. > <<< > > We have a SQL developer that years ago introduced the concept of > "ANDing" and "ORing" to the status values of many, many production > process to the extent there is now tons of code like,,, > > WHEN e.STATUS & 0x400000 = 0x400000 THEN 'FTP ERROR' > WHEN e.STATUS & 0x200000 = 0x200000 THEN 'FTP DONE' > WHEN e.STATUS & 0x100000 = 0x100000 THEN 'FTP START' > WHEN e.STATUS & 0x40000 = 0x40000 THEN 'ERROR' > WHEN e.STATUS & 0x20 = 0x20 THEN '0 RECS TO EXPORT' > WHEN e.STATUS & 0x20000 = 0x20000 THEN 'EXPORT DONE' > WHEN e.STATUS & 0x1 = 0x1 THEN 'STARTED' > WHEN e.STATUS = 0 THEN 'QUEUED' > > Good idea in theory, one value can hold many various status states - bad > idea in trouble shooting and refactoring - as the results of various > processes need to be evaluated through the "math" just to determine > where something failed exactly...
It's a bitwise. I have lots of columns that work that way for a "Status" about an operation. SELECT attributes, -- & 00001000) attr, attributes & Power(2, 0) isbinder, attributes & Power(2, 1) UpdatedPageCount, attributes & Power(2, 2) RippedwAlch, attributes & Power(2, 3) FontSub, attributes & Power(2, 4) RequiredbyDistiller, attributes & Power(2, 5) IgnorePFError, attributes & Power(2, 6) IgnoreFontSubError, attributes & Power(2, 7) IgnoreUnConfirmedError, attributes & Power(2, 8) ManuallyUpdatedPageCount, attributes & Power(2, 9) REplacedByPrePress, attributes & Power(2, 10) RippedwithApago, attributes & Power(2, 11) IsPageIndependant, attributes & Power(2, 12) RippedWithGhost, attributes & Power(2, 13) ImageFormatPNG, attributes & Power(2, 14) AllOfThem , CONVERT(varchar(10),StoreItem.created,101) created This will create 15 columns of detail for what exists in the same column "attributes" _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

