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 2008 Forums
 Transact-SQL (2008)
 Convert text to date

Author  Topic 

dplaut
Starting Member

7 Posts

Posted - 2010-03-18 : 13:16:00
How can I convert this:
Tuesday, July 22, 2008 16:20

to a smalldatetime?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-18 : 13:39:43
[code]SELECT CONVERT(datetime,LTRIM(SUBSTRING(datefield,CHARINDEX(',',datefield)+1,LEN(datefield))),109) FROM Table[/code]

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

Go to Top of Page

dplaut
Starting Member

7 Posts

Posted - 2010-03-18 : 13:51:33
Wow! Many thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-19 : 12:57:21
welcome

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

Go to Top of Page
   

- Advertisement -