gpt4 book ai didi

sql-server - 在 Select 子句中使用管道符号

转载 作者:行者123 更新时间:2023-12-02 22:35:19 25 4
gpt4 key购买 nike

是否有任何方法/使用将管道符号 || 放入 select 子句中。

我在一篇文章中遇到了以下查询(可能是连接两个值),但是当我尝试在查询中使用相同的查询时,我收到语法错误。

select FirstName ||''|| LastName As CustomerName from Customer

如果我使用了错误的语法,请纠正。

最佳答案

您可以使用适用于 SQL Server 2012 及更高版本的 CONCAT() 函数,或者仅使用简单的 + 符号来进行串联。

https://msdn.microsoft.com/en-us/library/hh231515(v=sql.110).aspx

Returns a string that is the result of concatenating two or more string values.

关于sql-server - 在 Select 子句中使用管道符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30048342/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com