Database Query

Results 1 to 2 of 2

Thread: Database Query

  1. #1
    Join Date
    Dec 1969

    Default Database Query

    In relation to my previous query to retrieving the names of columns from a particular table (for which I can&#039;t stop thanking Bill for), I have yet a another query. Now these columns have their names abbreviated. E.g. Tennis Courts have been abbreviated to TCourts. Now upon retrieving the name of the column(e.g. TCourts), is there any way I can have it being outputted as Tennis Courts. The only problem I face is that some tables have in excess of 50 columns.<BR><BR>Thanks!!

  2. #2
    Join Date
    Dec 1969

    Default Ooooghh..

    It&#039;s really too bad this database wasn&#039;t properly normalized. If all of these things are features of a given property, then they *should* have been in a "PropertyFeatures" table separate from the main table. And then you have a "Features" table to give the full spelling.<BR><BR>I think you are stuck using an ugly SELECT CASE on this one.<BR><BR>You could build up a dictionary of abbreviations vs. full names, but that would take just as much code and be slower.<BR><BR>SO:<BR><BR>SELECT CASE LCase(abbrev)<BR> CASE "tcourts" : full = "Tennis Courts"<BR> CASE "hydra" : full = "Hydra Spa"<BR> CASE "zamboni" : full = "Hockey Arena"<BR> ...<BR> CASE ELSE : full = abbrev &#039; for when abbreviation and full are same<BR>END SELECT<BR><BR>It&#039;s ugly, but you only have to write it once, and it&#039;s fast.<BR><BR>But go whack the DB designer on the head.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts