問(wèn)題描述
例如,在我運(yùn)行查詢并查看輸出之后
After I run a query and view the output, for example
select * from People
我的輸出如下
First Last Email
Ray Smith raysmith@whatever.itis
如何導(dǎo)出這些數(shù)據(jù),使其看起來(lái)如下所示?
How would I export this data so that it looks as follows?
"Ray","Smith","raysmith@whatever.itis"
或者有沒(méi)有辦法在 SQL 中執(zhí)行此操作以修改記錄以包含引號(hào)?
Or is there a way to do this within SQL to modify records to contain quotes?
因?yàn)楫?dāng)您導(dǎo)出時(shí),它無(wú)論如何都會(huì)包含逗號(hào),對(duì)嗎?
Because when you export, it's going to include the commas anyway, right?
推薦答案
如果您感興趣的列不超過(guò) 128 個(gè)字符,您可以使用 QUOTENAME 函數(shù).請(qǐng)注意這一點(diǎn),因?yàn)槿魏纬^(guò) 128 個(gè)字符的內(nèi)容都將返回 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
這篇關(guān)于在 SQL 輸出中插入雙引號(hào)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!