problem with convert text to time in sql server 2008? -


I have this Ttime as nvarchar (10): "09:52:48 "And I have TmpTime as the date and I try to convert it like this:" Update Main Set TmpTime = CONVERT (DATETIME, Ttime, 108) "

And get in i TmpTime : "1901-01-01"

Why?

Thanks in advance

If you also have a date field, you To insert, they must be added first:

  create table # sample (Dated: Varchar (10), Timefield varchar (10)); # Include in sample values ​​('2009-01-24', '09: 52: 48'); # Choose Convert (convertime, datefilled + '+ + timefilled) from converted to converted format  

and you will get:

 converted -------- - -------------- 2009-01-24 09: 52: 48.000 

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -