Solved

SSRS and Line Breaks from SQL Server stuff statement

Posted on 2013-01-23
2
1,174 Views
Last Modified: 2013-01-24
I have created a stored procedure that gets Client Visits

In the select I'm grabbing ClientName and I want to use a stuff statement to get all the contact nots for the visit.

How can I do that and render as line breaks in SSRS 2005?
Can I add  + '<br />' + in the Stuff portion?
Of vbcrlf?

In the following example I want one row of data per client in my SSRS Report, but you can see I want several Comments.
I know I can nest these on the SSRS sid with another recordset...just rather not.

Client         Comments
Apex           Comment1
                    Comment2
                    Comment3


This is my current select in the stored procedure
SELECT  [CVT].id ,
    [CVT].[Client ID] ,
    [CVT].[Contact ID] ,
    C.[Client Association],
    C.[Client Name],
    C.[Client State],
    [CVT].requester ,
    [CVT].createdDate,
    [CVT].createdBy  [Scheduled By],
    [CVT].[Account Executive] ,
    [CVT].departDate ,
    [CVT].meetingDate ,
    [CVT].returnDate ,
    [CVT].scheduleComment ,
    [CVT].visitStatus ,    
    CAST([CVT].notificationSent AS INT) [AE Notified],
    STUFF(( SELECT ' ' + CC.[First Name] + ' ' + CC.[Last Name] + '-' + B.Notes					 
			FROM	dbo.[Client Contact Events] AS B
			INNER JOIN dbo.[Client Contacts] CC
			ON B.[Contact ID] = CC.[Contact ID]
			WHERE	[CVT].[Client ID] = B.[Client ID]
				AND	B.EventType = 'Visit'
				AND	B.[Contact Date] > [CVT].createdDate  FOR XML PATH ('')),1,0,'') AS [Contact Notes]
FROM	dbo.ClientVisitTracking [CVT]
INNER JOIN Client C
	ON	[CVT].[Client ID] = C.[Client ID]

Open in new window

Next Client
0
Comment
Question by:lrbrister
2 Comments
 
LVL 6

Accepted Solution

by:
liija earned 500 total points
ID: 38811400
Not with <br>. Have you tried simple CHAR(10) inside the SQL instead?

In SSRS you can do the same with expression - if the comments where in separate columns
=dataset!comment1.value & chr(10) & dataset!comment2.value
0
 

Author Closing Comment

by:lrbrister
ID: 38814253
yay!  Thanks
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now