I am trying to alter a table by adding a new column. New column name = today's date. I don't know how to code the apostrophe.Trying ALTER TABLE tblname ADD today's date DATETIME
asked Apr 18, 2012 at 02:16 AM in Default
OK @Usman has shown you how to do it and @Magnus has explained the dangers in doing so, but I have to ask why you would want to store a value of today's date in a column? That does smell like a bad design.
What happens when I read the data entered yesterday, tomorrow?
Even if the table only ever contains "today's" data, name the column with something that reflects what the date means (e.g. EnteredDate, InsertedDate, LogDate, etc) - then you can see easily if the data has been refreshed.
If the data never can go stale, and is always "today's" then no need to store a date at all
answered Apr 18, 2012 at 07:11 AM
Kev Riley ♦♦
There are couple of ways you can do this, but I prefer not to use spaces,single quotes etc. in the object names
Anyways, one way to do it is to put square brackets around the column name i.e.
Another way is to have