【问题标题】:single quotation in SQL Server [duplicate]SQL Server中的单引号[重复]
【发布时间】:2010-10-26 01:29:30
【问题描述】:

可能重复:
concatenating string

我之前发布了一个类似的问题,并询问了如何使用 SQL Server 输出带有单引号的结果。有人可以教育我吗?

select ' ' + CustomerID + ',' 
  from dbo.Customers 

customerid 
------------
ALFKI, 
ANATR, 
ANTON, 
AROUT, 
BERGS,

希望看到结果

customerid 
-----------
'ALFKI', 
'ANATR', 
'ANTON', 
'AROUT', 
'BERGS', 

等等……

【问题讨论】:

标签: sql sql-server tsql string


【解决方案1】:
select '''' + CustomerID + ''',' 
  from dbo.Customers 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-29
    • 2016-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多