Thanks for taking the time to read the article and to respond.
Your data Mendel is wrong and your are trying to fix it with convoluted code,.
This is quite true. Sometimes data models are wrong, and sometimes people aren't willing or able to redesign their data models. These are detestable people and deserve all the scorn that can be heaped upon them. What can I say? I'm an enabler. Some people give bums on the street a dollar. Not me. I go to the liquor store and buy them a bottle of their favorite gin.
Proper SQL does not use assembly language bit flags.
I kept getting syntax errors until I set the EVIL_ROTTEN_NO_GOOD_SQL flag to True.
All dates are kept in ISO-8601 display format.
This really threw me for a loop. My dates aren't in ISO-8601 display format, yet you say that all dates are in that format. At first I thought I really messed up and that what I thought were dates were really watermelon instead. But I did some digging around and found out that the previous DBA had set the ALTERNATE_TIME_SPACE_CONTINUUM flag to 'Watermelon'. This is yet another example for the need for documentation.
We have ANSI Standard CAST() and not the old Sybase CONVERT()any more.
As a founding member of the International Brotherhood of CONVERT() Users, I take umbrage with this statement. Sure, everyone thinks we're a bunch of Sybase holdovers, but in truth most of have suffered broken limbs, and CAST() simply brings back too many painful memories. People scoff at our cause, but our Super-PAC has successfully lobbied to keep CONVERT() in SQL Server for yet another major release.
IDENTITY is never a relational key by definition
I found this out the hard way. All my database tables used to have IDENTITY columns as the primary key. But then one night, I heard furious knocking on my door. In my half-sleep I opened the door and suddenly I was being beaten with rubber chickens by Dr. Codd and Chris Date. Boy was that embarrassing, and damned difficult to explain to the Mrs.
I assuemt hat was just a quickie and not anything you would do in produciton code.
Your generosity knows no bounds. Good luck recovering from your eye surgery. Several years ago when I had eye surgery I saw double vision for a brief time, but I fixed it up with an indexed view (so to speak).