PC Review


Reply
Thread Tools Rate Thread

Auto insert of date

 
 
srigoogle
Guest
Posts: n/a
 
      31st Mar 2007
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.

 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      1st Apr 2007

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

--
Brendan Reynolds
Access MVP

"srigoogle" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      1st Apr 2007
Oops! Almost missed something! You want the time too, so you'll want to use
Now() rather than Date() in JET SQL.

--
Brendan Reynolds
Access MVP


"Brendan Reynolds" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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
>
> --
> Brendan Reynolds
> Access MVP
>
> "srigoogle" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto date insert bry25_uk Microsoft Excel New Users 5 3rd Mar 2008 11:48 PM
auto date completion or insert date in word 2007 =?Utf-8?B?ZHQ0NmR0NDZkdDQ2?= Microsoft Word Document Management 1 12th Aug 2007 05:58 AM
auto insert date Mike G Microsoft Word New Users 1 7th Jun 2007 07:31 PM
Auto Insert Date? Dunner Microsoft Access Macros 4 25th Aug 2004 09:18 AM
Auto insert date Rescueme Microsoft Access Database Table Design 2 19th Sep 2003 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:38 PM.