Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source Type 200 in SQL Server Import and Export Wizard?

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.

like image 559
kabichan Avatar asked Feb 12 '13 00:02

kabichan


People also ask

What is the difference between using select into and the SQL Import export Wizard?

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.

How do I restore a SQL Server database from a BAK file?

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.


2 Answers

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

like image 194
James Sampica Avatar answered Oct 11 '22 04:10

James Sampica


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

like image 38
Andrey Morozov Avatar answered Oct 11 '22 05:10

Andrey Morozov