Add carriage return inside a varchar variable

I'm defining a varchar variable in a stored procedure and it would be easier to read if I could insert carriage returns into the variable.

Here's the variable

SET @BODY1 = @SEVERITY +  @SUBJ +  @FNAME + ' ' + @LNAME +
      ' ' + @COMPANY + ' ' + @PHONE + ' ' + @EMAIL +  @FB_DESC

@BODY1 is the @message parameter for xp_SENDMAIL so I don't know if there is another option for me.

Thanks,
SEANWYATTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
rafranciscoCommented:
Try adding CHAR(13) like this:

SET @BODY1 = @SEVERITY + CHAR(13) + @SUBJ +  CHAR(13) + @FNAME + ' ' + @LNAME +
     ' ' + @COMPANY + ' ' + @PHONE + CHAR(13) +' ' + @EMAIL + CHAR(13) + @FB_DESC
0
 
Jan FranekCommented:
you can insert char(13) and char(10) into your string - on most clients it will create desired effect:

e.g.
SET @BODY1 = @SEVERITY +  char(13) + char(10) + @SUBJ +  char(13) + char(10) + @FNAME + ' ' + @LNAME +
     ' ' + @COMPANY + ' ' + @PHONE + ' ' + @EMAIL +  @FB_DESC
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
ispalenyCommented:
carriage returns is
CHAR(13)+CHAR(10)
0
 
SEANWYATTAuthor Commented:
Thanks all three!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.