sql - Open text file in SSIS and store the first line in a variable -
what best can open txt file
in ssis
, store first line variable.
i want put list of accounts in txt file
, use them in sql task
.
refer link @ozren gave you, create proper flat file connection e.g myfile
, variable e.g.headerline
. create script task, put headerline var in read/write variables
, code with:
system.io.streamreader file = new system.io.streamreader(dts.connections["myfile"].connectionstring); dts.variables["headerline"].value = file.readline(); file.close();
that's pretty it, can put standard dataflow read filedata file db or resultset.
you'll have first line in headerline variable, can use anywhere want in ssis package.
Comments
Post a Comment