Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Row Seperator in Stored Procedure

Author  Topic 

TonyO
Starting Member

2 Posts

Posted - 2010-10-21 : 14:39:41
Greetings. I am looking for a way to add a blank row between all rows returned by my stored procedure.

i.e. Stored procedure queries USER table with fields NAME, AGE, LOCATION. The table contains 5 entries. The normal result would be:

Albert, 38, MA
Sue, 29, SC
John, 32, TX
Ralph, 27, CA
Sally, 17, NY

What I want to do is add an empty row after each result.

Albert, 38, MA
<new row>
Sue, 29, SC
<new row>
John, 32, TX
<new row>
Ralph, 27, CA
<new row>
Sally, 17, NY
<new row>

I don't want the empty rows in the table itself, just in the return. I hope I have been clear enough in what I need. If not, please advise and I will try to illustrate further.

The actual stored procedure is written by someone else, but I can modify. In case it helps, I will add it as well.


SELECT TOP (5) dbo.Application.Id AS appID, dbo.Application.DisplayName, dbo.Application.Description, dbo.XFile.Path AS Swatch,
dbo.ApplicationVersion.Id AS appvid, dbo.ApplicationVersion.Major, dbo.ApplicationVersion.Minor, dbo.ApplicationVersion.Build,
dbo.Application.Summary, dbo.LayerRevision.Published, Manager.dbo.FN_GETMYAPPLASTSTARTBYNAME(dbo.Application.DisplayName)
AS TOTALTIME
FROM dbo.Application INNER JOIN
dbo.Swatch ON dbo.Application.Swatch = dbo.Swatch.Id INNER JOIN
dbo.ApplicationVersion ON dbo.Application.Id = dbo.ApplicationVersion.Application INNER JOIN
dbo.XFile ON dbo.Swatch.XFileLarge = dbo.XFile.Id INNER JOIN
dbo.LayerRevision ON dbo.ApplicationVersion.Id = dbo.LayerRevision.Layer
WHERE (dbo.LayerRevision.Published IS NOT NULL)
ORDER BY TOTALTIME DESC

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-21 : 14:53:18
You should not add this formatting to the stored procedure. It will unnecessarily complicate it. You should do this formatting in your application (the presentation layer).

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

TonyO
Starting Member

2 Posts

Posted - 2010-10-21 : 14:56:31
The problem with that is I am doing this in a bound datagridview which only allows me to add empty rows at the end.

I'll look around at more options then. Thanks for taking a look.
Go to Top of Page
   

- Advertisement -