Solved

SSRS and Line Breaks from SQL Server stuff statement

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

726 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