Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Formatting string from stored procedure
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01520619
Message ID:
01520623
Views:
32
>>Hi,
>>
>>When I write an error to return from a stored procedure (or trigger) what character can I use to break a line?
>>For example, in VFP I can have CHR(13) in the place where I want to break the line. What can I do with (for example) the following:
>>
>>
>>RAISERROR('First line of the message. Second line of the message', 16, 1)
>>
>>
>>What kind of character to add in the line above?
>>
>>TIA
>
>You can use CHAR(13) in SQL Server, however, in RAISERROR command you can not insert it right away. You will need to create a variable first.
>In other words,
>
>declare @ErrorMsg varchar(max)
>
>set @ErrorMsg  = 'First Line of the message' + char(13) + 'Second line of the message'
>
>RAISERROR(@ErrorMsg, 16,1)
Thank you very much. The variable approach works.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform