SQL add date column, change format, and change date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jrod2541
    New Member
    • Jun 2014
    • 26

    SQL add date column, change format, and change date

    So I'm trying to make a query that adds a column to my table named "Table1". That column's name id "Date". (I'm not sure the syntax to add a DATE/TIME datatype)

    Code:
    ALTER TABLE Table1 
    ADD COLUMN Date DATE;
    After that I'd like to also like to change the format to "yymmdd",
    Code:
    Format(Date, "yymmdd")
    , and change the date (or make it default) to what ever the date is.
    Code:
    NOW()
    Is there any way I can do this in access or is it impossible?
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3653

    #2
    Jarod,

    Is there a reason you must do this via VBA, rather than just adding the field in design view? I believe it is possible to do what you want in VBA, although I would have to do some learning myself.....

    Comment

    • us hosting
      New Member
      • Jul 2014
      • 10

      #3
      While adding the column, specify the format.

      Comment

      • Jerry Maiapu
        Contributor
        • Feb 2010
        • 259

        #4
        Maybe explaining what you what to achieve can enlighten members to resolve the issue with more amicable approach because what you are mentioning is bit strange in db design.

        Usually you will be trapped in this sort of situation when your table relationship are not defined properly.

        Thanks!

        Comment

        Working...