Sven
Sven

Reputation: 371

Cast/Convert plain text to RTF in T-SQL

I'm looking for a way to simply convert/cast plain text to RTF in my T-SQL INSERT statement. I'm working from excel where I generated a bunch of INSERT statements. Problem is that the tool reading from the DB requires that the text be in RTF format.

Can this be done?

Thanks in advance!

Upvotes: 1

Views: 6681

Answers (1)

JohnS
JohnS

Reputation: 2052

You could try:

DECLARE @RTFHeader VARCHAR(55)
DECLARE @RTFFooter VARCHAR(50)
SET @RTFHeader = '{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard '
SET @RTFFooter = '\par}'
SELECT @RTFHeader + 'This is your plain text.' + @RTFFooter

Save the resulting text as a .RTF file

Upvotes: 3

Related Questions