Quantcast
Viewing all articles
Browse latest Browse all 24688

converting string to datetime

I am trying to convert string to datetime .

Sql table is returning -December 1,2012 and i am using execute sql task in ssis package to convert this to datetime i.e. 2012-12-01 00:00:00:000.

I am using below query :But it is giving me an error saying "conversion failed".Can some one please help me in correcting this.

DECLARE

@BeginDate VARCHAR(MAX),

@CalculatedBeginDate

DATETIME;

SET

@BeginDate ='May 30 2012 3:42PM'

SELECT

@CalculatedBeginDate =CONVERT(DATETIME,@BeginDate);

SELECT

@CalculatedBeginDate;


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>