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.

 All Forums
 Development Tools
 Other Development Tools
 Date Range Problem

Author  Topic 

dzach
Starting Member

38 Posts

Posted - 2006-11-17 : 17:32:47
I've got the following ASP code I'm using to try and select a date range from a form but I'm getting do data returned with my syntax.


set rsCustSurvey = conn.Execute ("Select Incident_ID, ProblemDescriptionTrunc, Action_Summary, RootCause, Problem_Solution002, " _
& " AssignedTechnician, DATEADD(s, dbo.TTS_Main.DateClosed, '1/1/1970') AS DateClosed, DATEADD(s, dbo.TTS_Main.Date_Opened, '1/1/1970') AS DateOpened From tts_main Where ProblemDescriptionTrunc LIKE '%" & prob & "%' And Last_Name LIKE '%" & l_name & "%' " _
& " AND AssignedTechnician LIKE '%" & assigned_tech & "%' AND Date_Opened BETWEEN "& date_later_than &" AND "& date_earlier_than &" " _
& " Order By DateClosed DESC ")


Am I missing something obvious here?

Thanks!
Dale

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-11-17 : 19:14:04
An occasional carriage return to make it possible to read would be helpful.




CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-17 : 23:56:45
You need to embed the dates in the last with single quotes, just as you embed the names.

AND Date_Opened BETWEEN '"& date_later_than &"' AND '"& date_earlier_than &"' " _


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

dzach
Starting Member

38 Posts

Posted - 2006-11-20 : 09:31:25
Peter, thanks!

Dale
Go to Top of Page
   

- Advertisement -