Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I am looking to create some timestamp fields (or other date/time style fields), what is the best way to name them? Should I just put record_timestamp?

share|improve this question
up vote 21 down vote accepted

You should describe the purpose of the column and not necessarily the data type. You can include date/time/timestamp in the name, but you should also include the meaning. For example

  • CreationDate
  • StartDate
  • Start
  • End
  • StatusTime
  • Accessed
  • Updated

Adding Date/Time/Timestamp and such at the end is particularly useful when the abscence of the addition would conflict with another column. For example, a table may need both a Status and a StatusTime.

share|improve this answer
4  
The trouble comes when “CreationDate” is actually a timestamp. Makes it difficult to talk about. – bignose May 13 '11 at 1:25
1  
@bignose - then I suppose it follows that you'd use "CreationTimestamp" or something like "CreatedAt" – Jack Douglas May 13 '11 at 11:33
    
START is a reserved word – Nicolas Manzini Oct 19 '15 at 12:03

How about xyz_at for a timestamp and xyz_on for a date field - eg start_at or start_on?

Normally I'd avoid including the data type in the field name - much better if you can infer what you need to know about the type from the name of any field (a field called description is unlikely to be an integer) - but being able to tell the difference between a timestamp and a date is often helpful.

share|improve this answer

I use:

  • created_at
  • updated_at
share|improve this answer
    
"at" can imply location too. What about "when" instead of "at"? – Sepster Oct 22 '13 at 1:12
1  
"at" or "as at" is used frequently in legal and financial documents to refer to when something happened. english.stackexchange.com/questions/112770/… – Neil McGuigan Dec 19 '13 at 19:05

I looked at your profile and it says you work with SQL Server and in SQL Server TIMESTAMP data type has nothing to do with date or time and its used to kind of version stamping the rows. This is very useful in identifying which rows have been modified from a given point of time.

If you use TIMESTAMP then you don't have to specify a column name and SQL Server will create a column "TimeStamp" for you. But it is recommended to use "ROWVERSION" data type and in this case you have to specify the column name.

What's the best name for a column like this? It depends, and I would use something like VersionStamp, RV etc... What I consider important is NOT how you name it but are you using that consistently across the board.

HTH

Ref: http://msdn.microsoft.com/en-us/library/ms182776(v=sql.90).aspx

http://msdn.microsoft.com/en-us/library/ms182776.aspx

share|improve this answer

I prefer to use a prefix of DT for date stamps. For example: DTOpened, DTClosed, DTLastAccessed. This lets me list out all the DTxxxx for a quick reference of all date stamps in a given table.

share|improve this answer

I would used a meaningful prefix and _TSMP as a suffix e.g. CREATION_TSMP or LAST_UPDATE_TSMP

share|improve this answer
9  
−1, the data type shouldn't be part of the name. – bignose May 13 '11 at 1:26

I work for Texas Instruments, and on their systems they use xxxx_dttm

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.