|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding a line return to an SQL messgeHI 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 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 > > select 'error' + char(13) + 'message'
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 > > > 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 > > 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 > > Another method:
EXEC sp_addmessage 60000, 10, 'This is a multi-line message' RAISERROR(60000, 10, 1) -- Show quoteHope 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 > > 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 > > > > > > This begs the question about why format output from SQL Server instead of
the client application... -- Show quoteArnie 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 > > 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 >> >> > > >> 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? Thebasic 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. --CELKO-- (jcelko***@earthlink.net) writes:
> Why are you doing display in the database and not the front end? The But if the message has to have to its line breaks in certain places, > 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. 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 |
|||||||||||||||||||||||