Home All Groups Group Topic Archive Search About

Adding a line return to an SQL messge

Author
22 Jun 2006 11:52 AM
Robert Bravery
HI all,

I'm adding a custom SQL message. How do I insert a new line, line feed. So
that the message is split between a few lines

Thanks
Robert

Author
22 Jun 2006 11:51 AM
Uri Dimant
Robert
SELECT 'HELLO'+ CHAR(13)+'World'





Show quote
"Robert Bravery" <m*@u.com> wrote in message
news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
> HI all,
>
> I'm adding a custom SQL message. How do I insert a new line, line feed. So
> that the message is split between a few lines
>
> Thanks
> Robert
>
>
Author
22 Jun 2006 11:52 AM
Omnibuzz
select 'error' + char(13) + 'message'
--
-Omnibuzz (The SQL GC)

http://omnibuzz-sql.blogspot.com/



Show quote
"Robert Bravery" wrote:

> HI all,
>
> I'm adding a custom SQL message. How do I insert a new line, line feed. So
> that the message is split between a few lines
>
> Thanks
> Robert
>
>
>
Author
22 Jun 2006 12:22 PM
Aaron Bertrand [SQL Server MVP]
A "proper" CR+LF pair is:

SELECT 'foo' + CHAR(13) + CHAR(10) + 'bar';





Show quote
"Robert Bravery" <m*@u.com> wrote in message
news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
> HI all,
>
> I'm adding a custom SQL message. How do I insert a new line, line feed. So
> that the message is split between a few lines
>
> Thanks
> Robert
>
>
Author
22 Jun 2006 12:22 PM
Aaron Bertrand [SQL Server MVP]
A "proper" CR+LF pair is:

SELECT 'foo' + CHAR(13) + CHAR(10) + 'bar';





Show quote
"Robert Bravery" <m*@u.com> wrote in message
news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
> HI all,
>
> I'm adding a custom SQL message. How do I insert a new line, line feed. So
> that the message is split between a few lines
>
> Thanks
> Robert
>
>
Author
22 Jun 2006 12:46 PM
Dan Guzman
Another method:

EXEC sp_addmessage 60000, 10, 'This
is
a
multi-line
message'
RAISERROR(60000, 10, 1)


--
Hope this helps.

Dan Guzman
SQL Server MVP

Show quote
"Robert Bravery" <m*@u.com> wrote in message
news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
> HI all,
>
> I'm adding a custom SQL message. How do I insert a new line, line feed. So
> that the message is split between a few lines
>
> Thanks
> Robert
>
>
Author
22 Jun 2006 2:54 PM
Robert Bravery
Thanks
Robert
Show quote
"Dan Guzman" <guzmanda@nospam-online.sbcglobal.net> wrote in message
news:uHwpxnflGHA.4080@TK2MSFTNGP03.phx.gbl...
> Another method:
>
> EXEC sp_addmessage 60000, 10, 'This
> is
> a
> multi-line
> message'
> RAISERROR(60000, 10, 1)
>
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> "Robert Bravery" <m*@u.com> wrote in message
> news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
> > HI all,
> >
> > I'm adding a custom SQL message. How do I insert a new line, line feed.
So
> > that the message is split between a few lines
> >
> > Thanks
> > Robert
> >
> >
>
>
Author
22 Jun 2006 3:36 PM
Arnie Rowland
This begs the question about why format output from SQL Server instead of
the client application...

--
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."

*Yet Another Certification Exam


Show quote
"Robert Bravery" <m*@u.com> wrote in message
news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
> HI all,
>
> I'm adding a custom SQL message. How do I insert a new line, line feed. So
> that the message is split between a few lines
>
> Thanks
> Robert
>
>
Author
23 Jun 2006 4:32 PM
Randall Arnold
Sometimes it's just a heck of a lot easier to do in SS than a given client.
A good example is a spreadsheet I created for one of my coworkers that draws
data from some SS queries.  Word wrap wasn't working the way he wanted on
some column headers and adding the CR between 2 key parts of the field alias
solved the problem.

Randall Arnold

Show quote
"Arnie Rowland" <ar***@1568.com> wrote in message
news:upvDfGhlGHA.836@TK2MSFTNGP02.phx.gbl...
> This begs the question about why format output from SQL Server instead of
> the client application...
>
> --
> Arnie Rowland, YACE*
> "To be successful, your heart must accompany your knowledge."
>
> *Yet Another Certification Exam
>
>
> "Robert Bravery" <m*@u.com> wrote in message
> news:ukG8HCflGHA.4772@TK2MSFTNGP03.phx.gbl...
>> HI all,
>>
>> I'm adding a custom SQL message. How do I insert a new line, line feed.
>> So
>> that the message is split between a few lines
>>
>> Thanks
>> Robert
>>
>>
>
>
Author
25 Jun 2006 3:39 AM
--CELKO--
>> I'm adding a custom SQL message. How do I insert a new line, line feed. So that the message is split between a few lines <<

Why are you doing display in the database and not the front end?  The
basic principle of a tiered architecture is that display is done in the
front end and never in the back end.  This a more basic programming
principle than just SQL and RDBMS.
Author
25 Jun 2006 8:43 AM
Erland Sommarskog
--CELKO-- (jcelko***@earthlink.net) writes:
> Why are you doing display in the database and not the front end?  The
> basic principle of a tiered architecture is that display is done in the
> front end and never in the back end.  This a more basic programming
> principle than just SQL and RDBMS.

But if the message has to have to its line breaks in certain places,
that is just as much data as the text itself, and should be stored in the
database. 



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button