Sql Server添加单引号

时间:2022-06-24 04:08:54
" ' "(单引号)的运用:在sql server中,两个" ' "(单引号)在拼接字符串的情况下运用,就是表示拼接上了一个" ' "单引号字符串。

SELECT TOP 1 ''''+CONVERT(nvarchar(50),keyid)+'''' name1 FROM Rel_ProductStockLock with (nolock) WHERE KeyId IS NOT NULL
SELECT TOP 1 ''''+CONVERT(nvarchar(50),keyid)+''',' name2 FROM Rel_ProductStockLock with (nolock) WHERE KeyId IS NOT NULL
SELECT '''' name3;
SELECT '123''' name4;
SELECT '123'+'' name5;
SELECT  '"123"' name6;
SELECT TOP 1 '123'+AreaName name7 FROM dbo.Dim_Area;
SELECT TOP 1 '123'''+AreaName name8 FROM dbo.Dim_Area;
SELECT TOP 1 '123'''+AreaName+''  name9 FROM dbo.Dim_Area;
SELECT TOP 1 '123'''+AreaName+'''' name10 FROM dbo.Dim_Area;
 

Sql Server添加单引号

 

 

https://www.cnblogs.com/zhaosw/p/6088040.html  关于sql 拼接字符串的问题