Failed importing file in SQL Server Managment studio - database

In SQL Server Management Studio I exported a table from one database to an .xslx file, then imported it to another database on a different server. It failed to import and gave the following details:
Validating (Error)
Messages
• Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "QuestionID".
(SQL Server Import and Export Wizard)
• Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
(SQL Server Import and Export Wizard)
• Error 0xc004706b: Data Flow Task 1: "component "Destination - HJFast_Track" (47)" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)
• Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
(SQL Server Import and Export Wizard)

My best guess is that QuestionID is an auto-incrementing identity field. In order to insert values into that column you'll need to specify.
SET IDENTITY_INSERT YourTable ON
Your other option if that field is an auto-increment identity is leave it out of the import/export and let the sql engine generate keys like it would for any other insert.
Without having the schema of your table in front of me a guess is as good as I can offer.
If you update your question with the structure of the table your trying to insert that might give other clues. For example, if QuestionID is a guid or something.

Related

SQL Server import and export wizard - change concurrent setting

I am trying to export several (~40) tables using the SQL Server import and export wizard (Right click database -> Task -> Export Wizard).
The wizard allows me to export all tables from database, 1 by 1, without error.
However, when I want to export all tables together, there is an error. I guess it is due to a concurrency issue (because the screen shows 2 tables are exporting together).
Can I change concurrency settings of the wizard? (set maxconcurrentexecutables to 1 in SQL Server). Or, do I need to use SSIS?
The error message is below:
Pre-execute (Error) Messages Error 0xc0202009: Data Flow Task 2: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error
code: 0x80040E37. (SQL Server Import and Export Wizard)
Error 0xc02020e8: Data Flow Task 2: Opening a rowset for "Table16" failed. Check that the object exists in the database. (SQL Server
Import and Export Wizard)
Error 0xc004701a: Data Flow Task 2: Destination 7 - Table16 failed the pre-execute phase and returned error code 0xC02020E8. (SQL Server
Import and Export Wizard)

SQL Server import data

When I'm trying to import data from a flat file (text file) to SQL Server, I get some errors:
Validating (Error)
Messages
Error 0xc00470b6: Data Flow Task 1: The LocaleID 1 is not installed on this system.
(SQL Server Import and Export Wizard)
Error 0xc004706b: Data Flow Task 1: "Source - student_TXT" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)
Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
(SQL Server Import and Export Wizard)
Help please
When using variable names you can set the setting delay validation to true. That will solve one of your issues. If you could tell us more about what localeid1 is, perhaps we could help you further?

mssql exporting stops in validating step

I am using microsoft sql server and i am trying to export my database but i get an error in the last step. Here is the full report:
Operation stopped...
- Initializing Data Flow Task (Success)
- Initializing Connections (Success)
- Setting SQL Command (Success)
- Setting Source Connection (Success)
- Setting Destination Connection (Success)
- Validating (Error)
Messages
Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "BookId".
(SQL Server Import and Export Wizard)
Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
(SQL Server Import and Export Wizard)
Error 0xc004706b: Data Flow Task 1: "Destination - BookTable" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)
Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
(SQL Server Import and Export Wizard)
- Prepare for Execute (Stopped)
- Pre-execute (Stopped)
- Executing (Success)
- Copying to [dbo].[BookTable] (Stopped)
- Copying to [dbo].[ChartTable] (Stopped)
- Copying to [dbo].[UserTable] (Stopped)
- Post-execute (Stopped)
It seems like there is an error in Validating step.
I am assuming that your Bookid is an AutoIncrement field and you are trying to populate data into that table from another source. You have to use Enable Identity Insert in your mapping to allow the Bookid to be updated.
Also, be sure that your seed is above the last value you inserted in the data exchange or you could run into errors down the road because you turned off safety checks when you overrode the Identity Insert behavior.

Importing data from worksheet into SQL Server

I am trying to import data from MS Excel (Pro Plus 2013) to SQL Server 2014. Every time I attempt to do so I get the errors below. The columns in the the table are set to nvarchar(50) while in Excel none of the columns have more than 30 characters. I have tried recreating the Excel spreadsheet over and over again, just to be sure I am doing everything right. I just can't get the data to import.
These are the errors I receive:
Validating (Error) Messages:
Warning 0x802092a7: Data Flow Task 1: Truncation may occur due to inserting data from data flow column "Agent_First_Name" with a length of 255 to database column "Agent_First_Name" with a length of 50.(SQL Server Import and Export Wizard)
Warning 0x802092a7: Data Flow Task 1: Truncation may occur due to inserting data from data flow column "Agent_Last_Name" with a length of 255 to database column "Agent_Last_Name" with a length of 50.(SQL Server Import and Export Wizard)
Warning 0x802092a7: Data Flow Task 1: Truncation may occur due to inserting data from data flow column "Agent_Email" with a length of 255 to database column "Agent_Email" with a length of 50.(SQL Server Import and Export Wizard)
Warning 0x802092a7: Data Flow Task 1: Truncation may occur due to inserting data from data flow column "Agent_Extension" with a length of 255 to database column "Agent_Extension" with a length of 4.(SQL Server Import and Export Wizard)
Warning 0x802092a7: Data Flow Task 1: Truncation may occur due to inserting data from data flow column "Agent_Cell_Phone" with a length of 255 to database column "Agent_Cell_Phone" with a length of 10.(SQL Server Import and Export Wizard)
Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "Agent_ID".(SQL Server Import and Export Wizard)
Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.(SQL Server Import and Export Wizard)
Error 0xc004706b: Data Flow Task 1: "Destination - tableAgents" failed validation and returned validation status "VS_ISBROKEN".(SQL Server Import and Export Wizard)
Error 0xc004700c: Data Flow Task 1: One or more component failed validation.(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.(SQL Server Import and Export Wizard)
It looks like you're trying to import into an existing table. I would recommend starting with importing the data into a new table (for example, "tmpAgent" -- and you can delete this table later). Allow SQL Server to pick the tables size of the import, or you can set the size in the "Edit mappings" section of the import.
After you have imported the data into a new table, then create a query to move it into your Agent table.
I encountered the same error message.
Turns out I had a rogue cluster of merged cells in the excel file. I un-merged those cells, re-tried the import, and all my data were successfully imported to the excel file.

Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column

I am using SQL Server 2008 import and export wizard. I need to import a database. I opened the SQL server import/export wizard and I went through the following actions:-
for the destination I chose "SQL server native client 10".
then I selected copy data from one or more tables or view.
SSIS run immediately
but i got the following errors,
Operation stopped...
Initializing Data Flow Task (Success)
Initializing Connections (Success)
Setting SQL Command (Success)
Setting Source Connection (Success)
Setting Destination Connection (Success)
Validating (Error)
Messages Error 0xc0202049: Data Flow Task 1: Failure inserting into
the read-only column "ActionID". (SQL Server Import and Export
Wizard)
Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
(SQL Server Import and Export Wizard)
Error 0xc004706b: Data Flow Task 1: "component "Destination -
AuditActions" (22)" failed validation and returned validation status
"VS_ISBROKEN". (SQL Server Import and Export Wizard)
It seems that I can not import identity columns and timestamps columns, so how I can force these values to be imported?
With all due respect to Kishore's answer, that approach is valid if you're modifying the packages. Since you're using the import/export wizard, the more straight forward approach would be to check the Enable Identity Insert box on the Column Mappings tab.
In the Import Export Wizard, after selecting the table for copy, click the Edit Mappings... button
In the resulting screen, click the Enable identity insert property and your identities will be replicated over.
Same net result as issuing SET IDENTITY_INSERT TableName ON & OFF but this is done automagically at build time.
Before Importing date execute the below query to set identity insert on:
SET IDENTITY_INSERT TableName ON
Then do the import operations.
After importing date execute the below query to set identity insert off:
SET IDENTITY_INSERT TableName OFF
You can also check the box of Keep Identity in connection manager pane of Destination connection, when creating a data flow string. It worked for me.
enter image description here

Resources