"Column information for the source and the destination data could not be retrieved, or the data types of source columns were not mapped correctly to those available on the destination provider."
...
"Column "col1": Source data type "200" was not found in the data type mapping file."...
(The above line repeats for each column)
The work-around I have to do is to manually map each column in the "Edit Mappings..." option from the "Configure Flat File Destination" page of the wizard. This is an extreme inconvenience to have to have to edit the mappings and change each column to "string [DT_STR]" type from "byte stream [DT_BYTES]" type each time I want to export to csv. I did not have to do this before installing SP1; it worked perfectly for months with hundreds of exports prior to this update and no need to modify mapping.
I am running Windows 7 64-bit, SQL Server 2012 Express edition. Again, just yesterday from Windows Update, I installed SQL Server 2012 Service Pack 1 (KB2674319), followed by Update Rollup for SQL Server 2012 Service Pack 1 (KB2793634). This situation was
not occurring before these updates were installed, and I noticed it immediately after they were installed (and of course I restarted my computer after the updates).
In SSMS I just now created a test DB and table to provide a step-by-step with screenshots.
Here is the code I ran to create the test DB and table:
CREATE DATABASE testDB; GO USE testDB; GO CREATE TABLE testTable ( id int, lname varchar(50), fname varchar(50), address varchar(50), city varchar(50), state char(2), dob date ); GO INSERT INTO testTable VALUES (1,'Smith','Bob','123 Main St.','Los Angeles','CA','20080212'), (2,'Doe','John','555 Rainbow Ln.','Chicago','IL','19580530'), (3,'Jones','Jane','999 Somewhere Pl.','Washington','DC','19651201'), (4,'Jackson','George','111 Hello Cir.','Dallas','TX','20010718'); GO SELECT * FROM testTable;
Results look good:
id lname fname address city state dob
1 Smith Bob 123 Main St. Los Angeles CA 2008-02-12
2 Doe John 555 Rainbow Ln. Chicago IL 1958-05-30
3 Jones Jane 999 Somewhere Pl. Washington DC 1965-12-01
4 Jackson George 111 Hello Cir. Dallas TX 2001-07-18
In Object Explorer, I right-click on the [testDB] database, choose "Tasks", then "Export Data..." and the SQL Server Import and Export Wizard appears. I click Next to leave all settings as-is on the "Choose a Data Source" page, then on the "Choose a Destination"
page, under the "Destination" drop-down I choose "Flat File Destination" then browse to the desktop and name the file "table_export.csv" then click Next. On the "Specify Table Copy or Query" page I choose "Write a query to specify the data to transfer" then
click Next. I type the following SQL statement:
SELECT * FROM testTable;
When clicking the "Parse" button I get the message "This SQL statement is valid."
On to the next page, "Configure Flat File Destination" I try leaving the defaults then click Next. This is where I am getting the error message (see screenshot below):
Then going to the "Edit Mappings..." option on the "Configure Flat File Destination" page, I see that all columns which were defined as varchar in the table are showing as type "byte stream [DT_BYTES]", size "0", the state column which is defined as char(2)
shows correctly however with type "string [DT_STR]", size "2" (see screenshow below):
So what I have to do is change the type for the lname, fname, address and city columns to "string [DT_STR]", then I am able to proceed with the export successfully. Again, this just started happening after installing these updates. As you can imagine, this
is very frustrating, as I do a lot of exports from many tables, with a lot more columns than this test table.
Thanks for your help.
I have the same problem. Only some columns are set to string, most columns are byte stream and it seems that behaviour is inconsistent and does not seem to depend on data type.
This occurs when I use Write Query for export, not Copy Table.
- Edited by Poppy Bronco Tuesday, May 28, 2013 10:37 AM