Advertisement

04.18.2005 at 08:18AM PDT, ID: 21392840
[x]
Attachment Details

Convert dd/mm/yyyy string to smalldatetime

Asked by rss2 in MS SQL Server

Tags: , ,

For the life of me I can't figure out why this is not working.

My SQL Server is set to using US dates. I have a list of dd/mm/yyyy formatted strings that I would like to update the smalldatetime column with.

This:

update ws
set time_dt = convert(varchar(10),[time],110),
lasttradedate_dt = convert(varchar(10),lasttradedate,110)


..comes up with this error:
Server: Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.

(where columns time_dt and lasttradedate_dt are in the smalldatetime format and columns [time] and lasttradedate are string that look like: dd/mm/yyyy)

I have tried SO MANY different ways. Can anyone help ?? MOST frustrating..
Start Free Trial
[+][-]04.18.2005 at 08:21AM PDT, ID: 13807150

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 08:21AM PDT, ID: 13807151

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: smalldatetime, convert, string
Sign Up Now!
Solution Provided By: rafrancisco
Participating Experts: 5
Solution Grade: A
 
 
[+][-]04.18.2005 at 08:25AM PDT, ID: 13807200

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 08:26AM PDT, ID: 13807213

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 08:37AM PDT, ID: 13807313

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 08:41AM PDT, ID: 13807356

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 08:47AM PDT, ID: 13807409

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 10:21AM PDT, ID: 13808357

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2005 at 09:47PM PDT, ID: 13812707

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32