繁体   English   中英

来自特定列的Concat字符串和新的字符串值SQL Server CE

[英]Concat string from specific column and new string value SQL Server CE

我有一个称为events表,在包含数据信息的列中无法更新它,并且我试图将字符串追加到我尝试过的查询的特定列。

Volunteer是“ Events表中的列,并折行

 UPDATE Events 
 SET Volunteers = Volunteers + @Volunteers +'\n'  
 WHERE Event_Name = @Event_Name

 UPDATE Events 
 SET Volunteers += @Volunteers +'\n'  
 WHERE Event_Name = @Event_Name

尝试了两种方式,但都不起作用。

例如,列包含“ abc”,并从参数“ 123”中添加另一个

所以看起来像这样

 abc
 123

在数据库中看起来像这样

我正在使用带有SQL Server CE数据库的Visual Studio(Windows窗体应用程序)。

有什么建议么?

        Try Using CHAR(13)

        see I explain 

        Declare @TableField varchar(50)
        Declare @Volunteers varchar(50)
        Declare @Result varchar(50)

        SET @TableField = 'abc'
        SET @Volunteers = '123'

        SET @Result= @TableField+CHAR(13)+@Volunteers

        SELECT @Result AS Result

        OUTPUT Paste Then like 

        abc
        123

        either char(13) or char(10) would work. 

        but ,char(10) = \n - new line
             char(13) = \r - go to the beginning of the line

        You Set On  Query AS 

         UPDATE Events 
         SET Volunteers = Volunteers+CHAR(13)+@Volunteers
         WHERE Event_Name = @Event_Name

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM