Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fitting > 9 values in DEC(1,0) column 1

Status
Not open for further replies.

vgicoder

Programmer
Sep 11, 2002
2
US
A previous design mistake had a column defined dec(1,0), which needs to contain the month of the year (1 = January to 12 = December). Obviously this works until we get to October (10). How can I easily fit 12 values into this column without redefining the column to 2 positions? Is there a "slick" way of accomodating?
 
I can see two pssible solutions.
First, to use negative values for months 10,11 and 12

Second, to use -1,0,1,2,....,9 for months 1 to 12 and to always add 2 when selecting.
 
Our solution was to store -3 for october (10), -2 for November (11) , and -1 for December (12). That made the presentation logic simply, IF negative value returned, ADD +13 to get correct result. Also our data conversion only affected 1/10 of the rows, and the code changes could be promoted independently. Of course the "correct" solution is to change the table definition and all the code and interfaces, but this solution cuts the time drastically.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top