Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old April 4th, 2016, 02:48 PM
popeye's Avatar
popeye popeye is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: New York, New York
Posts: 41 popeye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 49 m 36 sec
Reputation Power: 11
SQL - Compare String date with varchar() vailable

I have dates (format: mm/dd/yyyy) stored in a varchar(15) column named "DateReceived" in a SQL table.
I need to compare and get the difference (days) of these dates with a string variable named "NoticeDate" (format: mm/dd/yyyy). I am having problem converting these dates so I can calculate the difference using a select statement.
Something like:
select * from table1 where NoticeDate - DateReceived >30

I appreciate any help. Thx
__________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. -Stephen Hawking

Reply With Quote
Old April 6th, 2016, 09:22 AM
cwf's Avatar
cwf cwf is online now
Super Moderator
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 391 cwf User rank is Private First Class (20 - 50 Reputation Level)cwf User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 15 h 23 m 47 sec
Reputation Power: 11
Ideally, you would store dates using your database's native date data type so that you can use built in date functions. This will result in the least amount of data storage, the fastest queries, and the simplest sql statements.

It's not clear what sql database you are using, but you would need to store or convert your dates to a native date data type before you can perform any operations on the values.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > SQL - Compare String date with varchar() vailable


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap