Export from SQL server to Excel with rich-text staying in each cell

Richard Bonnette 0 Reputation points
2024-09-23T16:45:19.29+00:00

Need to export from SQL server database to Excel. Data type is ntext and contains rich text. I need the data from each record to maintain within one Excel cell and preserve the rich text, i.e. line breaks and formatting.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,575 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,714 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 44,501 Reputation points
    2024-09-23T19:02:51.29+00:00

    If you mean the Import/Export wizard:

    Text for Export/Import from/to Excel is limited to max. 255 characters.

    0 comments No comments

  2. Erland Sommarskog 111.1K Reputation points
    2024-09-23T20:50:56.74+00:00

    The simplest way to do this is do this from Excel. Select the Data tab in the Ribbon, and then Get Data which is the left-most alternative in recent versions or Excel. Then you should be able to find your way.

    The issue with the line breaks in SSMS depends on the version of SSMS and in modern versions of SSMS a setting - which defaults to retain line breaks, as I recall. You can get the most recent version of SSMS here: https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms.

    The setting is under Tools->Options->Query Results->Results to grid.

    But it is a lot better to drive the import from Excel. If you copy and paste, Excel may "get ideas".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.