Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    2

    Unanswered: Carriage return within column alias

    Is there a way to insert a carriage return or line feed in the middle of a column alias within a select statement? I tried using the CHAR function for the ascii value of the carriage return, but SQL Server wouldn't allow it inside the alias name for the column.
    Any ideas?

  2. #2
    Join Date
    Dec 2002
    Posts
    63

    Angry

    What are you trying to achieve with the end result? Is the result to be used in html or something? If so, you can use html tags in the header.

  3. #3
    Join Date
    Jul 2003
    Posts
    2

    End goal

    The database query will be used in an ASP script run from a web site. The problem was that there were so many columns that I couldn't fit them on one page landscape for printing. If I can put some of the column headings (which are declared as aliases in my SQL query) on two lines as opposed to one long heading line, it will save page space.

  4. #4
    Join Date
    Dec 2002
    Posts
    63
    The simple solution, then is to put the HTML tag in the alias.. ie

    SELECT col1 as 'COLUMN <BR> ONE'
    bla bla bla

    then when the column header is rendered by the asp, if it is set up correctly, it will put the break in. I believe, however, that there are ways to do this in HTML w/o the need of putting it in the column name.

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •