Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language 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 3rd, 2005, 12:47 PM
Authorized User
 
Join Date: Jun 2003
Location: Marikina, , Philippines.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rylemer Send a message via MSN to rylemer Send a message via Yahoo to rylemer
Default Convert Char Data Type to smalldatetime

I have a data stored in SQL database. I will called it ship_date. ship_date Data Type is CHAR. The records are stored like this 01/01/05, 02/05/05. I need to filter it using between 01/01/05 to 02/03/05, but since the Data Type is CHAR. the SQL command Between fails. How can I Filter it without changing the Data type directly to the database.

Thanks In advance.
Elmer
 
Old March 3rd, 2005, 01:42 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Try this:

WHERE
   Convert(datetime, ship_date ) BETWEEN '01/01/05' AND '02/03/05'
 
Old March 3rd, 2005, 02:26 PM
Authorized User
 
Join Date: Jun 2003
Location: Marikina, , Philippines.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rylemer Send a message via MSN to rylemer Send a message via Yahoo to rylemer
Default

Great it works thanks jbenson, I really appreciate your help.

Elmer
 
Old March 3rd, 2005, 03:13 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Not a problem, glad I could help and glad it works!

Jim




Similar Threads
Thread Thread Starter Forum Replies Last Post
code of convert xml data type in string by C# prafullaborade XML 2 May 24th, 2008 07:49 AM
Big challenge here! How to convert char* to char^? samiswt Visual C++ 2005 1 November 30th, 2007 09:09 PM
Convert from nvarchar(25) to smalldatetime aspless SQL Language 6 September 14th, 2007 09:21 AM
Convert byte[] to char[] mega .NET Framework 2.0 1 December 29th, 2006 11:29 AM
Error with SmallDateTime data type saturdave Classic ASP Databases 1 November 22nd, 2004 07:19 PM





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