Есть большая таблица в Excel'e
Есть созданная таблица с той же структурой в MS SQL 2008
Если в Management Studio выбрать Edit top 200 и простым CTRL+C/CTRL+V копировать данные - все происходит на отлично.
Попробовал Import And Export, скачал AccessDatabaseEngine, которого ему не хватало, запускаю импорт, при сравнении типов данных из файла и в таблице - возникают какие то мелкие ошибки с предложением конвертировать тип данных, но вроде ничего серьезного.
Зато сам процесс импорта уже завершается ошибками.
Сыпятся Warning'и:
|
---|
Warning 0x802092a7: Data Flow Task 1: Truncation may occur due to inserting data from data flow column "F2" with a length of 255 to database column "NAMESHORT" with a length of 90. (SQL Server Import and Export Wizard) |
несоответствие длинны полей. Не знаю, насколько это критично.
|
---|
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Unspecified error". (SQL Server Import and Export Wizard) Error 0xc020901c: Data Flow Task 1: There was an error with input column "F2" (108) on input "Destination Input" (69). The column status returned was: "The value violated the integrity constraints for the column.". (SQL Server Import and Export Wizard) Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (69)" failed because error code 0xC020907D occurred, and the error row disposition on "input "Destination Input" (69)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. (SQL Server Import and Export Wizard) Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - TABLE_NAME" (56) failed with error code 0xC0209029 while processing input "Destination Input" (69). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure. (SQL Server Import and Export Wizard) Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020. (SQL Server Import and Export Wizard) Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - Лист1$" (1) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. (SQL Server Import and Export Wizard)
|
в чем проблема - не могу понять. возможно надо как-то специфически подготовить файл сперва?
Попутно вопрос номер 2 - импортировал свою таблицу в другую, новую, созданную при импорте.
Как можно по-простому перекопировать все данные из одной таблицы в другую?
Как цикл по кол-ву строк таблицы сделать - знаю, как сделать INSERT - тоже, а так же надеюсь, что будет достаточно просто подставить данные из одной таблицы в поля другой, но в таблице нет какого либо ID, по которому можно было бы обратиться, чтоб в теле цикла копировать конкретную строку.