Chase
Chase

Reputation: 584

Insert line break into SQL Query embedded in Excel Workbook Connection

Using: t-SQL, SSMS 2008, Excel 2010

Background: I have a SQL query that I've embedded into an Excel workbook via Connection that the end user can refresh. This query returns a column with a long string of sentences, basically a paragraph (this column's datatype is flexible).

What I Am Trying To Do: I would like each sentence of the paragraph to start on a new line in the Excel cell that it's in.

Example of UNDESIRED formatting: enter image description here

Example of DESIRED formatting: enter image description here

What I've Tried: I've tried adding the CHAR(13) linebreak to the SQL query. It correctly prints the paragraph with the desired line breaks in SSMS, but it doesn't transfer over to Excel, when the workbook is refreshed.

Upvotes: 2

Views: 4076

Answers (1)

xQbert
xQbert

Reputation: 35333

I'm not sure if you really need the wrapping of text. But I'm pretty sure you need both char(10) and char(13) carriage return and line feed (vbcrlf) equivalent.

Upvotes: 2

Related Questions