Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I've just read http://www.murach.com/books/sqls/article.htm and was rather alarmed. Does anyone have any comments on this?When I use a select query with dates in the where clause I tend to use ISO format (CCYYMMDD) as I find this the easiest to enter. I presume from the article that I need to enter times too. My problem is that I don't know how to enter times in this format.thanks steveSteve no function beer well without
byrmol
Shed Building SQL Farmer
1591 Posts
Posted - 2003-06-23 : 04:04:51
As the Hitch Hikers guide says "DON'T PANIC"Arnold Fribble has an elegant solution for Date without time queries....
SELECT DATEADD(d,0,DATEDIFF(d,0,GETDATE()))
Just replace the "getdate" function with your column name and see what happens....DavidM"SQL-3 is an abomination.."
Arnold Fribble
Yak-finder General
1961 Posts
Posted - 2003-06-23 : 04:31:43
That works, but I prefer it the other way around -- otherwise it goes funny if you use months or whatever