本文介紹了在 SQL 輸出中插入雙引號的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
例如,在我運行查詢并查看輸出之后
After I run a query and view the output, for example
select * from People
我的輸出如下
First Last Email
Ray Smith raysmith@whatever.itis
如何導出這些數據,使其看起來如下所示?
How would I export this data so that it looks as follows?
"Ray","Smith","raysmith@whatever.itis"
或者有沒有辦法在 SQL 中執行此操作以修改記錄以包含引號?
Or is there a way to do this within SQL to modify records to contain quotes?
因為當您導出時,它無論如何都會包含逗號,對嗎?
Because when you export, it's going to include the commas anyway, right?
推薦答案
如果您感興趣的列不超過 128 個字符,您可以使用 QUOTENAME 函數.請注意這一點,因為任何超過 128 個字符的內容都將返回 NULL
.
If the columns you're interested in are 128 characters or less, you could use the QUOTENAME function. Be careful with this as anything over 128 characters will return NULL
.
SELECT QUOTENAME(First, '"'), QUOTENAME(Last, '"'), QUOTENAME(Email, '"')
FROM People
這篇關于在 SQL 輸出中插入雙引號的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!