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
satheesh babu
NA
128
312.2k
varchar to date conversion in sql server 2005
Dec 24 2008 8:34 AM
Hi all,
i have a date column in my table with varchar(50), and i stored the values from front end with format
dd/mm/yyyy.
and i want to compare the dates like membership_expires between date1 and date2 its giving wrong result set.
so i am converting all the variables and columns into date format.
Below is my code to convert
select membership_expires,count(
membership_expires) from membershipregistration
where convert(datetime,membership_
expires,103) between
(select(convert(datetime,@
fromdate,103))) and
(select(convert(datetime,@
todate,103)))
group by Membership_Expires
and in the above i a providing @fromdate ,@todate from front end.
but its giving below error
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Please help me on this error and one more thing is if i store dates in dd-mm-yyyy format its working fine instead of dd/mm/yyyy
thank you....
Reply
Answers (
1
)
transport-level error has occurred when receiving results from the server (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
date conversion problem