TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
MARKAND BHATT
NA
3
19.9k
Get Records between two dates in MS SQL
Feb 7 2011 12:56 PM
I have a table in which i have a column named "dtCreated" which has got datatype as VARCHAR(50)
Now I want records between two dates.
I wrote my query as written below
SELECT
*
FROM
mytable
WHERE
dtcreated>=fromdate
AND
dtcreated<=todate
This query work fine when fromdate and ToDate are of same month. i.e if fromDate =1/1/2011
and todate is 1/31/2011 it will work fine
But if fromdate is 1/1/2011 and todate is 2/1/2011 then no records will be returned.
Please give me solution of it
Reply
Answers (
4
)
stored procedure
how to set the default value to the field in a sql table