Solved

AND ((cs.dtDateCreated >= '2007-11-07 00:00:00.000' AND cs.dtDateCreated <= '2008-01-15 00:00:00.000' + 1)

Posted on 2007-11-30
4
190 Views
Last Modified: 2010-03-20
I assume I need to cast?

AND ((cs.DateCreated >= '2007-11-07 00:00:00.000' AND cs.DateCreated <= '2008-01-15 00:00:00.000' + 1)
0
Comment
Question by:dba123
  • 2
  • 2
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
yes:

AND cs.DateCreated >= convert(datetime, '2007-11-07 00:00:00.000', 120)
AND cs.DateCreated < dateadd(day, 1, convert( datetime, '2008-01-15 00:00:00.000' ,120))
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
thank you.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
got it to work this way as well
AND ((cs.DateCreated >= CAST('2007-11-07 00:00:00.000' as varchar) AND cs.DateCreated <= CAST('2008-01-15 00:00:00.000' AS varchar))
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
>got it to work this way as well
this might work, but it is using implicit conversion format.
you should prefer the explicit way I suggested, it will save you from unexpected trouble you could get into later... on other servers ... etc...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now