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)
 Converting Varchar to SmallDateTime in SQL 2005

Author  Topic 

sanrajesh
Starting Member

3 Posts

Posted - 2009-02-05 : 20:59:34
Hi,
I need to convert the date field which is in Varchar in to SmallDateTime.

The varchar Date field is in the format "2009-01-29 00:00:00"

Using SSIS I have to transfer the date field to another field which is Smalldatetime.

I tried with CONVERT(SMALLDATETIME,CONVERT(VARCHAR, CURRENT_DATE,110),110) which transfer NULL values only.

Can you pl. help me out?

- Sanra

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2009-02-05 : 22:07:24
This may help:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=113803
http://www.developmentnow.com/g/113_2004_9_0_0_432913/Convert-Varchar-to-smalldatetime.htm
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-02-05 : 23:39:45
just simple u can write like this
declare @d varchar(32)
set @d ='2009-01-29 00:00:00'
select convert(smalldatetime ,@d)
Go to Top of Page
   

- Advertisement -