|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Bulk Insert Unix Text filesI am trying to import Unix text files into SQL Server 2005. I am having trouble with getting this to work: BULK INSERT MyDB.dbo.MyTable from 'c:\text.txt' WITH (fieldTERMINATOR = ' ',ROWTERMINATOR = '+CHAR(10)+',firstrow=6) Sample Data: ELEMENT ID Lay X Y Z ------------------------------ --- ------------ ------------ ------------ _PT1 217 740.000000 -79.859282 130.594085 _PT2 226 740.000000 -80.617765 129.797402 _PT3 226 740.000000 -84.037832 126.205085 Notice the extra spaces between fields, I think that might be what is holding it up?? Skip (mike_sylves***@voughtaircraft.com) writes:
Show quote > Hello All, ' ' means once space, not multiple. Given the sample, it looks like you> I am trying to import Unix text files into SQL Server 2005. I am having > trouble with getting this to work: > > BULK INSERT MyDB.dbo.MyTable from 'c:\text.txt' WITH (fieldTERMINATOR = > ' ',ROWTERMINATOR = '+CHAR(10)+',firstrow=6) > > Sample Data: > > ELEMENT ID Lay X Y Z > ------------------------------ --- ------------ ------------ > ------------ > _PT1 217 740.000000 -79.859282 > 130.594085 > _PT2 226 740.000000 -80.617765 > 129.797402 > _PT3 226 740.000000 -84.037832 > 126.205085 > > Notice the extra spaces between fields, I think that might be what is > holding it up?? might be best off to use s format file with fixed length for the format. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
|||||||||||||||||||||||