Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
incoming DATA file looks like :
populating a table that looks like :
create table my_import_ee_bestest (ee_id int, ee_signature varchar(20), ee_origin varchar(20))
then the appropriate FORMAT file would look like (and propably best to use real column names) :
<FIELD ID="1" xsi:type="CharTerm" TERMINATOR=";" MAX_LENGTH="20" />
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR=";" MAX_LENGTH="20" />
<FIELD ID="3" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="20" />
<COLUMN SOURCE="1" NAME="TCOLUMN1" xsi:type="SQLINT"/>
<COLUMN SOURCE="2" NAME="TCOLUMN2" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="3" NAME="TCOLUMN3" xsi:type="SQLVARYCHAR"/>
So, if you save the above DATA file as c:\EE\DATA.txt and the above format file as C:\EE\FORMAT.xml then the following command will work:
select * from openrowset(bulk 'c:\ee\data.txt', formatfile = 'c:\ee\format.xml') as a
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.