Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Datetime Conversion help

Author  Topic 

learntsql

524 Posts

Posted - 2010-09-09 : 05:45:59
Hi All,
I have column datatype as varchar and storing values "month-year"
like '10-2010'.
In display when i append '01-' to the existing value its not converting into proper datetime value.
What is the process?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-09-09 : 07:01:01
SELECT Col1, CONVERT(DATETIME, '01-' + Col1, 105) FROM Table1




N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

learntsql

524 Posts

Posted - 2010-09-09 : 07:05:23
Hi Peso,
ThanQ very much.
Go to Top of Page
   

- Advertisement -