Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004

    Unanswered: Using keywords as attributes

    I am using db keyowrds as attributes in my table such as from, to and date. These are enclosed in [] in SQL Server Enterprise Manager. I'm just asking if doing this is a bad idea? Reason being these are the most applicable names for these attributes but don't want to run into problems further down the line.



  2. #2
    Join Date
    Nov 2002
    1). Yes it's a bad idea, 2), they're not very descriptive names, 3). I'm suprised you didn't mentuion [id]

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jul 2004
    Hi Brett,

    Thanks for the reply.

    1) Figured as much
    2) Sure, buts its descriptive for my use. I am creating a table where a vehicle is going from somewhere to somewhere else. FROM and TO seemed to be the most obvious. However, now I am beginning writing the app its a pain to remember where to use the ['s
    3) I've kept them descriptive so far with %tableName%id for each surrogate key.

  4. #4
    Join Date
    Jul 2003
    San Antonio, TX
    Aren't Source and Destination descriptive enough?
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Feb 2004
    Actually, I think it's an interesting point. As -z0 says, there are applications running using these words which so happen to be sql keywords. So what do you do? Change the lot everywhere and everything avoiding usage of keywords alltogether, or, you just change the columnnames in sql making the connection between the application and the columns used less obvious, or, just use the keywords as columnnames?
    Besides, I don't think source and from are the same, even with vehicles. What I've seen so far, if a keyword such as from is used, a prefixed is used to make it not a keyword, eg: DN_FROM.

  6. #6
    Join Date
    Jul 2004
    Some good thoughts so far...

    I could easily have vehicleCollectionLocation and vehicleDeliveryLocation as the ultimate descriptive title but I want to cut out a bit of typing work to have the smallest column names which still mean something to me.

    I think something like vehicleFrom, vehicleTo, and bookDate or jobDate will do fine so as not to use keywords as column names.

    I just wanted to gain a census of whether using keywords was bad practice. It is, so I have learnt something new.

Posting Permissions

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