Need to convert Nvarchar to Datetimestamp
Hi... I am loading data from Excel to sql db inbetween i havbe used stage to dump the data into excel In my stage i have column date with the data as 21.09.2011 21.10.2011 I need to insert the target table with 2011-09-21 00:00:000 I am using SSIS Package for all this task Can any one plese suggest....
October 13th, 2011 5:18pm

Use Data Conversion Transformation .Shailesh, Please mark the post as answered if it answers your question.
Free Windows Admin Tool Kit Click here and download it now
October 13th, 2011 5:25pm

Hi, I recommend to use the T-SQL code to convert your staging column to dateTime. you can use the following code to use in the stagging source DECLARE @nstrdt nvarchar(20) SET @nstrdt = N'21.09.2011' SELECT CONVERT(datetime, (RIGHT(LEFT(@nstrdt,5),2) + '/'+LEFT(@nstrdt,2)+'/'+ RIGHT(LEFT(@nstrdt,10),4)+ SUBSTRING(@nstrdt,11, len(@nstrdt))), 120) as DtTime Output:- 2011-09-21 00:00:00.000
October 13th, 2011 7:14pm

If you wish to do in T-SQL Query then try this SELECT convert(datetime, '21.09.2011',104) Output 2011-09-21 00:00:00.000Shailesh, Please mark the post as answered if it answers your question.
Free Windows Admin Tool Kit Click here and download it now
October 13th, 2011 7:24pm

Agreed. good solution.
October 13th, 2011 7:35pm

Agreed. good solution.
Free Windows Admin Tool Kit Click here and download it now
October 13th, 2011 7:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics