By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

data type datetime ??

quadri
P: 17
when executing a query in sql 2005
select getdate() what you get , suppose

2008-05-08 12:41:10.587

Is ther any query where i can get date only and the datatype should be in datatime.
Is there any datatype only " date " in sql 2005. I heard its in sql 2008 ?
My exact problem is
For example ,here startdate datatype is datetime.
select * from dbo.Emp where startdate between 2008-05-08 and 2008-05-08.
i am getting 0 rows here.
what is the best way to select this query.

hope i explained it clearly.


TIA
May 8 '08 #1
Share this Question
Share on Google+
2 Replies


quadri
P: 17
i found somthing related to it

http://www.sql-server-performance.com/articles/dev/datetime_2008_p1.aspx
May 8 '08 #2

code green
Expert 100+
P: 1,726
This one method.
Expand|Select|Wrap|Line Numbers
  1. SELECT CONVERT(VARCHAR,GETDATE(),103) 
You can also use different types from VARCHAR and different codes to change the format
This is a very good article
http://www.sqljunkies.ddj.com/Articl...C7FD826E5.scuk
May 8 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.