Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date from date time sql server 2005

Status
Not open for further replies.

pungigis

Programmer
Dec 5, 2007
71
US
Need help with the following, fairly new to sql.

The inner join is not working correctly because the transactiondate has an actual time and the fulldate has all zeros so I just want to join on the dates, how do I strip off the time and accomplish this????


select
r.startcall,
r.skillset,
r.transactiondate,
r.calltime,
d.fulldate,
d.dayofweek
from
dbo.vw_reportinginboundcalldata r
inner join dbo.dim_date d on r.transactiondate = d.fulldate
where
r.startcall between '08/01/2010' and '08/07/2010' and
r.skillset = 'GRAYS' and
r.calltime not like 'After%' and
d.dayofweek in ('2','3','4','5','6')

 
I appreciate the blogs but they are not really showing me how to strip the date out of the date time, I understand why I shouldn't use between but still need to be able to strip the date out, if someone can show me an example that would be great.
 
I think Tibor's blog showed this.

Anyway, to strip time info
<pre>
declare @d datetime
set @d = getdate()
select @d as WithTime, dateadd(day, datediff(day,'19000101', @d), '19000101') as WithoutTime</pre>

PluralSight Learning Library
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top