Database Column Names != Report Headings

Always remember that the column names returned in a result set do not have to be the same as what you eventually output at your presentation layer.  

For example, suppose you have stored procedure that accepts a @CurrentYear parameter and returns a sales variance between the current year and the previous year for each customer.  I often see programmers struggling with writing dynamic SQL to produce output like this:

CustomerID   2008 Total    2007 Total   Variance
----------   ----------    ----------   --------
ABC          $100          $50          $50
DEF          $200          $250         -$50

That is, the names of the columns vary based on the data; that is not a good way to return data from your database!  A much better result set to return is simply this:

CustomerID   CurrentYear   PrevYear   Variance
----------   ----------    ---------  --------
ABC          $100          $50        $50
DEF          $200          $250       -$50

Notice that with that set of columns, no dynamic SQL is needed, and the column names returned are always constant regardless of the value of the @CurrYear parameter.  

As mentioned, the fact that your data set has columns labelled "CurrentYear" and "PrevYear" does not mean that you cannot re-label them any way that you like on your report or web page. 

If your client code called the stored procedure and provided a @CurrentYear parameter, then it knows exactly what "CurrentYear" and "PrevYear" represent, and you can easily label the columns in the final result exactly as needed with simple formulas or a few lines of code. 

Remember that in the world of relational database programming, table names and column names should be constant -- only the data itself should change.   Focus on returning consistently structured data from your database, and let your client applications handle the labeling of columns to make them look nice. 

152 Responses to “Database Column Names != Report Headings”


  1. MedicamentSpot.com. Canadian Health&Care.Special Internet Prices.Best quality drugs.No prescription online pharmacy. No prescription drugs. Buy pills online

    Buy:Cialis Professional.Viagra Super Force.Viagra.Tramadol.Cialis.Cialis Super Active+.Levitra.VPXL.Maxaman.Viagra Super Active+.Propecia.Soma.Cialis Soft Tabs.Viagra Professional.Viagra Soft Tabs.Zithromax.Super Active ED Pack….


  2. CheapTabletsOnline.com. Canadian Health&Care.Special Internet Prices.Best quality drugs.No prescription online pharmacy. No prescription drugs. Buy pills online

    Buy:Cialis.Cialis Professional.Zithromax.Levitra.Maxaman.Viagra Super Active+.Viagra Soft Tabs.Cialis Super Active+.Tramadol.Viagra Super Force.Propecia.Super Active ED Pack.Viagra.Viagra Professional.Soma.Cialis Soft Tabs.VPXL….


  3. NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

  4. abilify side effects in children

    Buydrugs without prescription…

  5. Accupril

    Buygeneric drugs…

  6. cephalexin dosage for dogs

    Buygeneric drugs…

  7. Buygeneric meds…

  8. actonel@adverse.reactions” rel=”nofollow”>…

    Buygeneric meds…

  9. shimmy@adalat.simone” rel=”nofollow”>..

    Buyit now…

  10. Advair@official.site” rel=”nofollow”>.

    Buynow it…

  11. fruite@of.the.earth.aloe.vera.juice.sale” rel=”nofollow”>…

    Buynow…

  12. allopurinol@and.coumadin” rel=”nofollow”>…

    Buygeneric drugs…

  13. Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  14. ..

    Buygeneric drugs…

  15. ashwagandha@supplement.now” rel=”nofollow”>…

    Buygeneric meds…

  16. atarax@and.hives” rel=”nofollow”>.

    Buygeneric drugs…

  17. Augmentin@official.site” rel=”nofollow”>.

    Buywithout prescription…

  18. Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  19. celexa@canada.now” rel=”nofollow”>.

    Buynow…

  20. Chantix@official.site” rel=”nofollow”>.

    Buydrugs without prescription…

  21. buy@cheap.viagra.in.uk” rel=”nofollow”>.

    Buywithout prescription…

  22. prozac@dangers.now” rel=”nofollow”>..

    Buygeneric drugs…

  23. Abilify@official.site” rel=”nofollow”>…

    Buynow…

  24. Abilify@official.site” rel=”nofollow”>…

    Buynow it…

  25. Zyvox@official.site” rel=”nofollow”>..

    Buygeneric pills…

  26. Depakote@official.site” rel=”nofollow”>…

    Buyit now…

  27. side effects zyprexa overdose breathing autonomic

    Buyno prescription…

  28. Zocor

    Buygeneric meds…

  29. buy zithromax online

    Buyno prescription…

  30. buy zinc anode everett wa

    Buygeneric meds…

  31. xopenex coupon

    Buyno prescription…

  32. dog zyrtec

    Buygeneric drugs…

  33. zyprexa increase eps complaints

    Buyno prescription…

  34. Vytorin

    Buynow…

  35. Zyvox

    Buydrugs without prescription…

  36. lioresal online

    Buygeneric drugs…

  37. Vitamin B

    Buynow it…

  38. where to buy lamisil

    Buygeneric drugs…

  39. Zyprexa

    Buydrugs without prescription…

  40. pharmacokinetics of zyrtec

    Buyit now…

  41. Rogaine

    Buygeneric meds…

  42. Rogaine

    Buyno prescription…

  43. Omnicef

    Buynow it…

  44. Synthroid

    Buygeneric pills…

  45. Seroquel

    Buywithout prescription…

  46. Retin A

    Buywithout prescription…

  47. Remeron

    Buyno prescription…

  48. purim suddah

    Buygeneric meds…

  49. howard county purim carnival 2010

    Buyno prescription…

  50. Synthroid

    Buywithout prescription…

  51. Synthroid

    Buygeneric meds…

  52. Risperdal

    Buygeneric pills…

  53. can i take expired zyrtec

    Buygeneric drugs…

  54. Zyprexa

    Buyno prescription…

  55. Purim

    Buyno prescription…

  56. savella diabetes blood sugar

    Buygeneric drugs…

  57. Pulmicort

    Buywithout prescription…

  58. low dose haldol and paxil

    Buygeneric drugs…

  59. Reglan…

    Buywithout prescription…

  60. Pyridium@Pyridium.Pyridium” rel=”nofollow”>…

    Buygeneric meds…

  61. Prozac@Prozac.Prozac” rel=”nofollow”>…

    Buynow…

  62. Tri@Cyclen.now” rel=”nofollow”>…

    Buyno prescription…

  63. Pulmicort@Pulmicort.Pulmicort” rel=”nofollow”>..

    Buyit now…

  64. Soma@Soma.Soma” rel=”nofollow”>.

    Buyno prescription…

  65. Sleep@Tea.now” rel=”nofollow”>..

    Buyno prescription…

  66. Prozac@Prozac.Prozac” rel=”nofollow”>…

    Buygeneric drugs…

  67. Synthroid@Synthroid.Synthroid” rel=”nofollow”>..

    Buynow it…

  68. Purim@Purim.Purim” rel=”nofollow”>…

    Buygeneric drugs…

  69. Strattera@Strattera.Strattera” rel=”nofollow”>…

    Buynow it…

  70. Spiriva@Spiriva.Spiriva” rel=”nofollow”>..

    Buyno prescription…

  71. Singulair@Singulair.Singulair” rel=”nofollow”>…

    Buygeneric pills…

  72. Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric pills…

  73. Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buywithout prescription…

  74. Singulair@Singulair.Singulair” rel=”nofollow”>.

    Buygeneric drugs…

  75. Buygeneric meds…

  76. allegra@print.colorado.springs” rel=”nofollow”>…

    Buygeneric drugs…

  77. chantix@vs.zyban” rel=”nofollow”>..

    Buyit now…

  78. retin@a.cheap.no.prescription” rel=”nofollow”>..

    Buygeneric drugs…

  79. what@is.the.generic.name.for.coreg.medication” rel=”nofollow”>…

    Buygeneric pills…

  80. high@dose.dexamethasone.induction” rel=”nofollow”>..

    Buydrugs without prescription…

  81. alternatives@to.premarin” rel=”nofollow”>…

    Buygeneric pills…

  82. altace@generic.name” rel=”nofollow”>.

    Buynow it…

  83. order@altace.cod” rel=”nofollow”>..

    Buynow…

  84. dosage@of.abilify” rel=”nofollow”>..

    Buynow it…

  85. Buyno prescription…

  86. wholesale@ginseng.root” rel=”nofollow”>…

    Buyno prescription…

  87. ..

    Buyit now…

  88. buy@generic.LEVITRA” rel=”nofollow”>…

    Need cheap generic LEVITRA?…

  89. Order@Cheap.Coral.Calcium” rel=”nofollow”>..

    Buygeneric pills…

  90. Order@Discount.Coral.Calcium” rel=”nofollow”>..

    Buyno prescription…

  91. Purchase@Cheap.Abilify” rel=”nofollow”>..

    Buynow it…

  92. Buy@Coral.Calcium.Online” rel=”nofollow”>.…

    Buygeneric drugs…

  93. Order@Discount.Coral.Calcium” rel=”nofollow”>..

    Buygeneric meds…

  94. Purchase@Cheap.Abana” rel=”nofollow”>…

    Buywithout prescription…

  95. Buy@Cheap.Acai” rel=”nofollow”>…

    Buygeneric drugs…

  96. Purchase@Cheap.Acai” rel=”nofollow”>…

    Buyit now…

  97. Cheap@Acai.Online” rel=”nofollow”>.

    Buygeneric meds…

  98. Order@Discount.Accutane” rel=”nofollow”>.…

    Buyno prescription…

  99. Buy@Generic.Aciphex” rel=”nofollow”>.…

    Buygeneric meds…

  100. Purchase@Generic.Aciphex.20mg” rel=”nofollow”>.…

    Buynow it…

  101. Buy@Generic.Actonel” rel=”nofollow”>.…

    Buygeneric drugs…

  102. Buy@Generic.Actonel.Without.Prescription” rel=”nofollow”>.…

    Buygeneric meds…

  103. Purchase@Generic.Actonel” rel=”nofollow”>.

    Buygeneric meds vbg…

  104. Purchase@Actonel.Without.Prescription” rel=”nofollow”>..

    Buynow it vhx…

  105. Buy@Actoplus.Met.Online” rel=”nofollow”>..

    Buygeneric drugs krg…

  106. Buy@Discount.Abana” rel=”nofollow”>.

    Buygeneric drugs zfk…

  107. Purchase@Discount.Abilify” rel=”nofollow”>..

    Buywithout prescription dyo…

  108. Order@Generic.Abilify” rel=”nofollow”>.

    Buyno prescription luw…

  109. Generic@Abilify.5mg.10mg.15mg.20mg.30mg.Without.Prescription” rel=”nofollow”>..

    Buydrugs without prescription faj…

  110. Purchase@Acai.Online” rel=”nofollow”>.

    Buyit now ojb…

  111. Buy@Generic.Acai.500mg” rel=”nofollow”>.

    Buygeneric drugs nih…

  112. Purchase@Cheap.Accupril” rel=”nofollow”>..

    Buyit now irl…

  113. Purchase@Discount.Accupril” rel=”nofollow”>…

    Buygeneric meds svb…

  114. Cheap@Accutane.Online” rel=”nofollow”>.

    Buynow it lmg…

  115. Cheap@Generic.Aciphex.20mg” rel=”nofollow”>…

    Buynow it zdg…

  116. Buy@Acomplia.Online” rel=”nofollow”>..

    Buyno prescription wkp…

  117. Cheap@Acomplia.Online” rel=”nofollow”>..

    Buygeneric drugs nvr…

  118. Get@Albenza.Online” rel=”nofollow”>…

    Buynow fjl…

  119. abilify@and.weight.gain” rel=”nofollow”>…

    Buyno prescription…

  120. phamacokinetic@of.amikacin” rel=”nofollow”>..

    Buygeneric drugs…

  121. ampicillin@500.mg” rel=”nofollow”>.

    Buydrugs without prescription…

  122. methotrexate and tricyclerides side effects

    Buy_generic pills…

  123. cancer tattoos

    Buy_without prescription…

  124. obesity children summer

    Buy_it now…

  125. prostate cancer injection treatment

    Buy_now it…

  126. medication for ibs

    Buy_generic drugs…

  127. effects of bulimia only sometimes

    Buy_generic meds…

  128. boniva price

    Buy_drugs without prescription…

  129. australia clinical research resume

    Buy_generic drugs…

  130. tests for assessing anxiety

    Buy_now it…

  131. thyroid scan image

    Buy_generic pills…

  132. side effects of luvox

    Buy_now…

  133. tylenol without codeine related constipation

    Buy_it now…

  134. advantage of skin cancer

    Buy_generic drugs…

  135. negative thyroid test

    Buy_no prescription…

  136. household chemicals that kill fleas

    Buy_now it…

  137. atkins diet first week foods

    Buy_without prescription…

  138. fungi amazing facts

    Buy_drugs without prescription…

  139. dog hives and what causes them

    Buy_drugs without prescription…

  140. depression amino acids

    Buy_drugs without prescription…

  141. best drug store foundation

    Buy_generic meds…

  142. when develop toxemia pregnancy

    Buy_it now…

  143. acne teens start treatment age

    Buy_it now…

  144. period changes leading up to menopause

    Buy_it now…

  145. drug additiction symptoms

    Buy_generic meds…

  146. new birth control pill

    Buy_now it…

  147. zocor orange juice effects

    Buy_no prescription…

  148. childrens ibuprofen diabetes

    Buy_without prescription…

  149. tsa drug dogs for adoptino

    Buy_generic drugs…

  150. barbecue interactions with drugs

    Buy_generic meds…

  151. green@mountain.coffee.cafe.club” rel=”nofollow”>…

    Buygeneric meds…

  152. protonix@experience.buy” rel=”nofollow”>…

    Buygeneric meds…