This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Microsoft SQL - get time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Microsoft SQL - get time" Watch "Microsoft SQL - get time" New topic
Author

Microsoft SQL - get time

Nicolas Tolksdorf
Greenhorn

Joined: Nov 07, 2001
Posts: 5
Is there a Microsoft SQL query which returns the present datetime.
Pseudo-code eg. select * from table1 where date > getTime(now)
Is there a MS SQL specific equivalent to 'gettime(now)'?
Rick Valdez
Greenhorn

Joined: Jul 24, 2003
Posts: 1
There is a getdate() function in T-SQL (Microsoft's SQL syntax used in SQL Server).
Just be aware that if you put getdate() in your WHERE clause, you might not get any results as it searches for a datetime stamp.
You can use a LEFT(getdate(), 11) in your WHERE clause and will return something like this...
Jul 24 2003
Nicolas Tolksdorf
Greenhorn

Joined: Nov 07, 2001
Posts: 5
Cheers for you help.
 
 
subject: Microsoft SQL - get time
 
Similar Threads
Sql optimizer
count number of coulmns in table?
The specified SQL type is not supported by this driver.
Where is Yukon
how do i do this urgent