Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2006, 06:16 PM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Text to DateTime Field

Hello,

I am writing reports in Crystal 8.5, using the SQL designer against a SQL 2000 DB. I am currently having problems with a WHERE clause giving me date/time errors.

The clause looks like this... WHERE app_date between '{?StartDate}' and '{?EndDate}'

The parameter fields are set to string. The statement is giving me a conversion error.

Any help would be greatly appreciated. I think I need to use a cast or convert command, but I am not exactly sure.

 
Old March 6th, 2006, 10:09 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Can you post the SQL statement exactly like it is being sent to SQL? Here's a couple of queries with BETWEEN statements that are working. In both examples the variable dates are in the same format as the datetime columns in the database. I hope this helps.

SELECT * FROM [Some Table] WHERE ('10/2/2005' BETWEEN StartDate AND EndDate)

SELECT * FROM [Some Table] WHERE (StartDate BETWEEN '10/1/2004' AND '12/5/2006')

Thanks,
Richard






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Use DateTime Field kcsathish ASP.NET 2.0 Professional 0 July 15th, 2008 01:01 AM
Datetime Field as index daworm MySQL 2 September 17th, 2006 11:33 PM
A doubt in DateTime field dhol General .NET 1 December 30th, 2004 01:33 PM
How do you search datetime field? SoC Classic ASP Basics 6 October 31st, 2004 09:39 PM
Query DateTime Field mtalam Access 5 June 3rd, 2004 06:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.