Solved

SSRS and Line Breaks from SQL Server stuff statement

Posted on 2013-01-23
2
1,165 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

747 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

13 Experts available now in Live!

Get 1:1 Help Now