在sql server中插入逗号分隔字符串的字符串

时间:2017-09-23 14:21:05

标签: sql-server

我想将"'765','76','70','70','80','82','11'"插入sql-server中的nvarchar列。怎么可能?

1 个答案:

答案 0 :(得分:1)

你走了:

DECLARE @N NVARCHAR(MAX);
SET @N = '''765'',''76'',''70'',''70'',''80'',''82'',''11''';
SELECT @N AS Result;

结果:

+-------------------------------------+
|               Result                |
+-------------------------------------+
| '765','76','70','70','80','82','11' |
+-------------------------------------+