Data conversion in script component
i know has been answered somewhere, have looked through responses , evidently missing something.
i have many flat flat files pipe "|" delimited (columns crlf row delimiter) going sql server common t-sql datatypes (varchar, char, decimal, integer, datetime, etc.).
what know can find guide or tips on configuring flat file input columns , output columns, etc., data go sql server, , if have cast or converts in vb.net, how syntax go? know in sense, data comes in flat file text. if date, example, 06/21/55 (which have), , goes sql server datetime, how configure data type of 1) input column, 2) output column, 3) vb.net conversion, , take care of if there question mark, space, or if empty. see methods like, todate, tostring, etc. see functions cdate(), etc.
i have example, don't know if correct, or sure whether work right, run:
row.anncp = rowvalues.getvalue(0).tostring()
row.annfl = rowvalues.getvalue(1).tostring()
row.anndt = rowvalues.getvalue(2).tostring()
row.recvr = convert.toint16(trim(rowvalues.getvalue(3)))
row.entdt = convert.todatetime(rowvalues.getvalue(4)).tostring
here another, different: row.anndt = cdate(streditedentdt)
some of found , copied , pasted other sources, not sure use , , why there many options. differences?
thanks input on this.
i have looked everywhere code has been written , beyond bare rudimentary, have not found yet.
... have data must cleaned, first, though. example, getting errors on date columns because have ? question marks in them. wanted convert them blanks, not sure how that. wizard gave me source, data conversion, , destination. , how clean out these question marks?
the ? mark in string column may not problem. convert blanks ssis developers typically use ssis expressions in derived column transformation.
a sample cleanup expression in be
replace( mycol1, "?", " " )
arthur my blog
SQL Server > SQL Server Integration Services
Comments
Post a Comment