Auto insert of date

  • Thread starter Thread starter srigoogle
  • Start date Start date
S

srigoogle

I'm trying to input some datas using preparedStatement and among those
coiumns one column is of type "smalldatetime" i wish to input the
current date and time at which i execute this query, how can i achieve
this in JDBC or what is the sql query for this.
 
I'm not sure if we're talking JET SQL or T-SQL or something else here? In
JET SQL you want the Date() function, something like ...

INSERT INTO Table1 ( TestDate )
SELECT Date() AS Expr1;

If you're using T-SQL you want the GETDATE() function, something like ...

INSERT INTO dbo.Table1
(TestDate)
SELECT GETDATE() AS Expr1
 
Oops! Almost missed something! You want the time too, so you'll want to use
Now() rather than Date() in JET SQL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top