November 6, 2010 at 4:17 am
Hi Guys,
Hope all is well,
this is a basic question to yourselfves im sure,
can someone please tell me how i can do the following.
I want to reference a Date table and i want to pull all information back between two dates i.e
01/10/2010 to 25/10/2010
How can i do this? is it ColumnName => '01/10/2010 <= '25/10/2010'
cant figure it out!!!!
November 6, 2010 at 5:21 am
use and
ColumnName => '01/10/2010 and ColumnName <= '25/10/2010'
take care abt DateTime storing in table and comparison/condition also in same format 103/101/ yyyy-mm-dd
November 6, 2010 at 5:26 am
brilliant,
Thanks for the information!!
November 6, 2010 at 12:12 pm
Pulivarthi Sasidhar (11/6/2010)
take care abt DateTime storing in table and comparison/condition also in same format 103/101/ yyyy-mm-dd
Only if the column is actually a varchar (which is a seriously bad idea). If the column is datetime then the parameter values will be implicitly cast to datetime before the comparison is done and the format that the parameters are in will not matter (proving the cast will work)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 6, 2010 at 8:28 pm
Hey Scott -
Try
WHERE date BETWEEN '2010-11-1' and '2010-11-2'
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply