Safi
Safi

Reputation: 141

SQL adding carriage returns to text

I'm quite a beginner at SQL and have a table with a column in which I have text, I want to use this text as the body of an email.

I want this body text to have carriage returns in it, but each time I send an email using it, it just comes out as one line. The text is this:

Please find your latest statement of account. Could you review any due or pending invoices & confirm payment by this Friday. If you have any queries please contact [email protected]

Regards xx

How do I make it so that carriage returns are kept in the text, and used when adding the text to an email?

Upvotes: 3

Views: 16981

Answers (1)

CatchingMonkey
CatchingMonkey

Reputation: 1391

You can use the CHAR(13) function to insert new lines. For example:

PRINT 'Hello ' + CHAR(13) + 'Safi'

Or

PRINT 'Hello ' + CHAR(10) + 'Safi'

A better exmaple:

PRINT 'Please find your latest statement of account. Could you review any due or pending invoices & confirm payment by this Friday.' + CHAR(10) + 'If you have any queries please contact [email protected]' + CHAR(10) + 'Regards'

Upvotes: 1

Related Questions