从特定列和新字符串值 SQL Server CE 中连接字符串
本文关键字:字符串 Server SQL CE 连接 | 更新日期: 2024-12-05 20:07:16
>我有一个名为 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
在数据库中假设看起来像这样
我正在使用Visual Studio(Windows Form Application)和SQL Server CE数据库。
有什么建议吗?
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