• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Microsoft SQL - get time

 
Nicolas Tolksdorf
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers for you help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic