SQL error trying to insert a date time value

Results 1 to 3 of 3

Thread: SQL error trying to insert a date time value

  1. #1
    Join Date
    Dec 1969
    Posts
    294

    Default SQL error trying to insert a date time value

    I am having errors inserting the current date into an Access database.<BR>Here is my shortened sql code (VBScript code)<BR><BR>insert into myTable(dateTimeStamp) values(&#039#" & Now & "#&#039)<BR><BR>If I take this portion of my sql out the query runs great. I have tried using just values(&#039" & Now & "&#039)<BR><BR>Can anyone help?<BR>Thanks<BR>

  2. #2
    Hugo Mejia Guest

    Default RE: SQL error trying to insert a date time value

    Without seeing the specific error (it&#039s more difficult that way), I see a couple of problems (which may or may not apply).<BR><BR>1. The expression &#039#" & Now & "#&#039 produces a string, which if you send to a date type field in the database, will produce an invalid type error.<BR>2. Assuming that you actually meant to write (in this posting) "#" & Now & "#", such expression will produce a date. You then need to make sure that the field to which you are sending this value takes a date, otherwise you&#039ll again see a data type error.<BR><BR>Is there any chance, you can repost with the error message(s) that you get?<BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    294

    Default RE: SQL error trying to insert a date time value

    I receive a SQL error, syntax error in Insert Into statement. The field I am passing it to is a Date/Time field

Posting Permissions

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