I am trying to import data from one database in a server to a new table in a different server, using SQL Server import and Export Wizard. (SQL Server Management Studio 2012)
In the wizard, I checked "Write a query to specify the data to transfer", and the SQL statement returns data containing the following four columns:
+-----------------------------------------------------------------------------+
| ID(varchar(100)) | Title(text) | Description(text) | IsActive(tinyint)|
+-----------------------------------------------------------------------------+
I want to change the types for the new table to
+----------------------------------------------------------------------------------------+
| ID(varchar(4)) | Title(varchar(200)) | Description(varchar(2000)) | IsActive(bit)|
+----------------------------------------------------------------------------------------+
So, in the "Column Mappings" page(In the "Select Source Tables and Views" page, I clicked "Edit Mappings..."), I changed the Destination Type to the above types.
Then, after clicking "Next", in the "Review Data Type Mapping" page, I get an error that says "Found 3 unknown column type conversion(s). You are only allowed to save the package
"
The Data type mapping shows the following information:
icon Source Column Source Type Destination Column Destination Type Convert
----------------------------------------------------------------------------------
error ID 200 ID varchar
error Title 200 Title varchar
error Description 201 Description varchar
warning IsActive tinyint IsActive bit
Even if I don't change the data type in the "Edit Mappings..." page, I get the same error.
I don't understand what "200" means in the context of a data type, and how can I import this data to a new table in a different server?
I appreciate any help.
Select into is a SQL query, and it is executed directly. Import and Export Wizard is a tool which invokes Integration Services (SSIS). Save this answer.
Right-click the Databases node in Object Explorer and select Restore Database.... Select Device:, and then select the ellipses (...) to locate your backup file. Select Add and navigate to where your . bak file is located.
With a bit of experimentation this error only seems to occur when you have a query as the source. The accepted answer did not work for me as copying to a flat file would result in the same error.
To solve this I put my query into a View
then selected Copy From one or more Tables Or Views
instead of Write a query...
.
I went through the wizard normally after that and my data went through with no error
Unfortunately this is a BUG. See (and vote up) links below:
--> SQL Server Import and Export Wizard Does Not Recognise Varchar and NVarchar
and
--> DTSWizard in SQL 2012 SP1 no longer recognizes nvarchar/varchar data types when source is a query
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With