本文介紹了sql server 中的新行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在使用一個程序來選擇名字和姓氏
I am using an procedure to Select First-name and Last-name
declare
@firstName nvarchar(50),
@lastName nvarchar(50),
@text nvarchar(MAX)
SELECT @text = 'First Name : ' + @firstName + ' Second Name : ' + @lastName
@text
值將發送到我的郵件但是名字和姓氏在一行中.我只需要在第二行顯示姓氏
The @text
Value will be sent to my mail But the Firstname and Lastname comes in single line. i just need to show the Lastname in Second line
O/P 名字:Taylor 姓氏:Swift ,
我需要像下面這樣的輸出格式
O/P First Name : Taylor Last Name : Swift ,
I need the output like this below format
First Name : Taylor
Last Name : Swift
推薦答案
嘗試使用 CHAR(13)
-
DECLARE
@firstName NVARCHAR(50) = '11'
, @lastName NVARCHAR(50) = '22'
, @text NVARCHAR(MAX)
SELECT @text =
'First Name : ' + @firstName +
CHAR(13) + --<--
'Second Name : ' + @lastName
SELECT @text
輸出 -
First Name : 11
Second Name : 22
這篇關于sql server 中的新行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!