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 |
|
Rajiv
Starting Member
1 Post |
Posted - 2010-06-24 : 07:15:41
|
| I am trying to import .csv files (in excel) using the following details:1. Format file9.0211 SQLCHAR 0 1000 "," 1 vehicleTypeID Latin1_General_BIN2 SQLCHAR 0 1000 "," 2 wheelPlanCode Latin1_General_BIN3 SQLCHAR 0 1000 "," 3 baseEuroClass Latin1_General_BIN4 SQLCHAR 0 1000 "," 4 PMEuroClass Latin1_General_BIN5 SQLCHAR 0 1000 "," 5 graduatedVEDCO2 Latin1_General_BIN6 SQLCHAR 0 1000 "," 6 LECorRPC Latin1_General_BIN7 SQLCHAR 0 1000 "," 7 modTypeCode Latin1_General_BIN8 SQLCHAR 0 1000 "," 8 country Latin1_General_BIN9 SQLCHAR 0 1000 "," 9 fuelClass Latin1_General_BIN10 SQLCHAR 0 1000 "," 10 weight Latin1_General_BIN11 SQLCHAR 0 1000 "," 11 busType Latin1_General_BIN12 SQLCHAR 0 1000 "," 12 engineCapacity Latin1_General_BIN13 SQLCHAR 0 1000 "," 13 taxClass Latin1_General_BIN14 SQLCHAR 0 1000 "," 14 bodyClass Latin1_General_BIN15 SQLCHAR 0 1000 "," 15 yearOfManufacture Latin1_General_BIN16 SQLCHAR 0 1000 "," 16 regDate Latin1_General_BIN17 SQLCHAR 0 1000 "," 17 nonCompliantFrom Latin1_General_BIN18 SQLCHAR 0 1000 "," 18 cameraID Latin1_General_BIN19 SQLCHAR 0 1000 "," 19 capturedDate Latin1_General_BIN20 SQLCHAR 0 1000 "," 20 capturedTime Latin1_General_BIN21 SQLCHAR 0 1000 "\n" 21 VRM Latin1_General_BIN2. location of the csv files and format files asE:\temp\lez2009_AQN3. SQl code as use lezSET NOCOUNT ONDROP TABLE #filelistCREATE TABLE #filelist (FileName varchar(100))INSERT INTO #filelist EXEC master..xp_cmdshell 'dir e:\temp\lez2009_AQN\*.csv /b'DECLARE @file varchar(100), @command varchar(1000)DECLARE FileCursor CURSOR FOR SELECT FileName FROM #filelist where FileName is not null OPEN FileCursor FETCH NEXT FROM FileCursor INTO @file WHILE (@@FETCH_STATUS = 0) BEGIN SELECT @command = 'bcp lez.dbo.anpr2009_AQN in e:\temp\lez2009_AQN\' + @file + ' -T -F2 -f e:\temp\lez2009_AQN\anpr.fmt' EXEC master..xp_cmdshell @command FETCH NEXT FROM FileCursor INTO @file END CLOSE FileCursorDEALLOCATE FileCursor4. I am trying to import the data in table dbo.anpr2009_AQNwhile running the code, I get the foll error:SQLState = HY000, NativeError = 0Error = [Microsoft][SQL Native Client]I/O error while reading BCP format fileNULL |
|
|
|
|
|
|
|