Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use SQL in access

Status
Not open for further replies.

jabond007

Programmer
Jun 21, 2000
39
US
I am new to access. I need to write SQL to insert date values to fields in table. Also system date is to be inserted into the table. <br>Like in Oracle i do it using Insert into table SYSDATE, dates as required.<br><br>a) How do i do this in access. Do i need to convert date function to string.<br><br>Regards<br>
 
this is SQL code to insert a Date in a text type.<br><br>INSERT INTO Orders ( [Yourdatefield] )<br>SELECT (&quot;11/13/00&quot;) AS Expr1;<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thanks Doug<br><br>I think i didnt ask the right question<br><br>I got a table(audit) . This table has to record the user name and the time stamp once user changes any data.<br>In oracle i would use SYSDATE for the system date.<br>I need the syntax to insert the current date into the table for access<br><br>The fields as Date fields. I am using Short date format mm/dd/yyyy.<br><br>
 
Use 'Now() to get the current system date and time;<br>optionally use, Format(&quot;mm/dd/yyyy h:m:s&quot;,now()), to format the value as you choose. Store this in a field having the 'Date' data type.<br><br>to update the record, usage is like: <br><br>&quot;Update [tablename] set [datestamp]=#&quot;& now() &&quot;# where ID=&quot; & UniqueNumericKeyForRecordBeingUpdated<br><br>or...<br>&nbsp;<br>&quot;Update [tablename] set [datestamp]=#&quot;& now() &&quot;# where ID=&quot;&quot;&quot; & UniqueTextKeyForRecordBeingUpdated &&quot;&quot;&quot;&quot;<br><br> <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top