Skip navigation
Currently Being Moderated

sql add blank row to result

Mar 17, 2009 6:05 PM

Hi,

I currently use a temporary table to add a blank row to the top/beginning of my query results. I'm moving to MS SQL stored procedures and wanted to know if it's possible to add a blank row right into my SQL so I can eliminate the temporary table solution.

Any thoughts on this are appreciated!

cfwild
 
Replies
  • Currently Being Moderated
    Mar 17, 2009 7:23 PM   in reply to cfwild
    > wanted to know if it's possible to add a blank row right into my SQL so I can eliminate
    > the temporary table solution

    You could use a union to merge your blank row with your other results and order it so the blank sorts on top. But why do you need a blank row? It sounds like mixing user interface code with database code ..
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 17, 2009 8:16 PM   in reply to cfwild
    You have to use SELECT with the string literal

    SELECT Category
    FROM Syndicated
    UNION
    SELECT '<HI>'
    ORDER BY Category
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points