Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Looktroniks
Starting Member
2 Posts |
Posted - 2010-10-28 : 04:50:06
|
Hi guys I'm having a serious trouble trying to import data in a textfile into an SQL database table: I tried the following:USE MyDatabaseGOBULK INSERT register1 FROM 'C:\myfile.txt'WITH ( FIELDTERMINATOR = ',' )GOAnd I get the following error:Server: Msg 4866, Level 17, State 66, Line 1Bulk Insert fails. Column is too long in the data file for row 1, column 2. Make sure the field terminator and row terminator are specified correctly.Server: Msg 7399, Level 16, State 1, Line 1OLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.The statement has been terminated.I also tried the DTS/Import Wizard and I got the following error:Error: Source: Microsoft Data Transformation Services Flat File Rowset ProviderError Description: Too many columns found in the current row; non-whitespace characters were found after the last defined column's dataContext: Error calling GetNextRows. Your provider does not support all the interfaces/methods required by DTSHe's my sample textfile and the original file is 97.4MBM1999028576, SUPERIOR TRUCK HIRE AND DISTRIBUTION SERVICEM1999028577, BATHOMI FINANCE COMPANYM2009011815, CAPRALINXM1999028578, QUANTUM LEAP INVESTMENTS 176M1999028581, BENBROW INVESTMENTSM1999028586, LAW VLEISM2000000004, KNOWLES HUSAIN LINDSAYB2000001178, LOSU VERVOERM1999028597, FINIAL HOLDINGSM1999028598, EQUISTOCK PROPERTIES 47M1999028599, PROMINENT FLUID CONTROLS (SOUTH AFRICA)M1999028600, LARITZA INVESTMENTS NO 71M1999028601, JM BUSHA ASSET MANAGERSM1999028604, VECTO TRADE 226M2001012384, MAYETM1999028606, IQUAD INVESTMENT INCENTIVESB2001038348, SEMANSHU GARDEN SERVICESB2000001179, CAV2 INVESTMENTM1999028609, DR JANNIE BARNARDPlease help!!! |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-28 : 05:50:49
|
Maybe the ROWTERMINATOR?Try:USE MyDatabaseGOBULK INSERT register1 FROM 'C:\myfile.txt'WITH ( FIELDTERMINATOR = ',' ,ROWTERMINATOR = '\n')GOor tryUSE MyDatabaseGOBULK INSERT register1 FROM 'C:\myfile.txt'WITH ( FIELDTERMINATOR = ',' ,ROWTERMINATOR = '\r\n')GOIf that doesn't help you should examine the file using a HexEditor to see the used rowterminator... No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
|
|
|
|
|