Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SSRS and Line Breaks from SQL Server stuff statement

Posted on 2013-01-23
2
Medium Priority
?
1,246 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

610 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