SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 convert time varchar to date
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

esthera
Flowing Fount of Yak Knowledge

1340 Posts

Posted - 08/20/2012 :  14:21:20  Show Profile  Reply with Quote
i have a time like
48:30.0

I am doing
select convert(datetime,'48:30.0',108)

but getting

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.


what am I doing wrong and what is the correct way of doing this?

Lamprey
Flowing Fount of Yak Knowledge

3831 Posts

Posted - 08/20/2012 :  14:25:42  Show Profile  Reply with Quote
What time system are you on? That looks like a Metric day, which SQL server doesn't support. (BTW, Metric Day is a joke about days having 100 hours).

If you look at the format for 108 it's: hh:mi:ss. Where the Hour needs to be between 1 and 23.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47152 Posts

Posted - 08/20/2012 :  17:27:35  Show Profile  Reply with Quote
how did you get the current time value? its not a valid value that can be stored in datetime compatible field

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000