?
Solved

SSRS and Line Breaks from SQL Server stuff statement

Posted on 2013-01-23
2
Medium Priority
?
1,223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
liija earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

770 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