visual studio 2008 - SSIS - Script Issue creating a DateTime -
i'm using ssis upload data csv file table database. try 2 strings (one date, other time) , concat them :
string datsdatetime = string.concat(row.date, " ", row.heure); then, try parse :
row.datetime = datetime.parseexact(datsdatetime, "dd/mm/yyyy hh:mm", null); but not work. when try test script, got error :
string not recognized valid datetime. @ system.datetimeparse.parseexact(string s, string format, datetimeformatinfo dtfi, datetimestyles style) @ scriptmain.input0_processinputrow(input0buffer row) @ usercomponent.input0_processinput(input0buffer buffer) @ microsoft.sqlserver.dts.pipeline.scriptcomponenthost.processinput(int32 inputid, pipelinebuffer buffer) i'm using visual studio 2008. idea it?
edit : in column "date" in csv file, date string : 20120101 (2012, 01 month , 01 day).
update : ok found solution doing this
string datsdatetime = row.date.insert(6,"/").insert(4, "/") + " " + row.heure; before pasing anything. hope it'll help.
you should change format
row.finaldate = datetime.parseexact(datsdatetime, "yyyymmdd hh:mm", null); since getting dates in yyyymmdd format dates stored not string integers .if want display data in dd/mm/yyyy format can use tostring() method specific format
yourdate.tostring("dd/mm/yyyy") but since storing in database ,it stored integers check dateformat in sql server
dbcc useroptions
Comments
Post a Comment