DT_IMAGE, which is not supported. Use DT_TEXT or DT_NTEXT instead

Afternoon,

I’ve been asked to export a load of tables to CSV files. I’m trying to use SQL Server Import and Export Wizard, the error im getting is:

Error 0xc0208030: Data Flow Task 1: The data type for "input column "CD_Document" (44)" is DT_IMAGE, which is not supported. Use DT_TEXT or DT_NTEXT instead and convert the data from, or to, DT_IMAGE using the data conversion component. (SQL Server Import and Export Wizard)

The error makes sence, I cannot have binary data in a CSV… As the error suggests I’ve gone back a few steps and in the ‘edit mappings‘ changed the requested collumn output to both DT_TEXT and DT_NTEXT… I keep getting the same error message….

Head scratching here, I must be doing something wrong but not sure what….. Any ideas?

Thanks

**If possible, replace deprecated SQL Server `image` columns with: VARBINARY(MAX)**

**Microsoft deprecated `image`, `text`, and `ntext` years ago.**

SELECT
*,
CONVERT(VARCHAR(MAX), CD_Document, 1) AS CD_Document_Text
FROM YourTable

remove original CD_Document
export CD_Document_Text instead. :winking_face_with_tongue:

Thank you, unfortunatly I don’t have authorisation to make changes to the database & its still being used… Am I not able to do the conversion on the fly as I export?

A common workaround is to export from a query instead of directly from the table.

SELECT
    Col1,
    Col2,
    CAST(ImageColumn AS VARBINARY(MAX)) AS ImageColumn
FROM dbo.YourTable

Run the query from SSMS or from the ‘Provide a Source Query‘ in SQL Server Import & Export?