I'm sure i can figure something out using replace
, etc, but just wondering if there is anything out there that lets you simply append data to a column rather than how the common Insert
function works?
我确信我可以用replace等来解决问题,但我想知道是否有什么东西可以让您简单地将数据附加到列中,而不是普通的Insert函数是如何工作的?
Well I guess i can do INSERT INTO TABLE (NAME) SELECT Name + @Name
right?
我想我可以插入到表(NAME)中选择NAME + @Name,对吧?
4 个解决方案
#1
44
Without more details, here's a simple example:
没有更多的细节,这里有一个简单的例子:
UPDATE YourTable
SET YourColumn = YourColumn + 'Appended Data'
#2
6
Not sure exactly what you are asking, but here is an example with a table named Names with two columns: id - int, name - nvarchar(max):
不确定您要问的是什么,但是这里有一个例子,表的名称有两个列:id - int, name - nvarchar(max):
update Names
set name = name + ' a string to append'
where id = 2
#3
3
UPDATE YourTable
SET YourColumn += 'Appended Data'
#4
2
I'm not sure what exactly you are trying to do, but the following illustrates how to use string concatenation to append "newValue" when a particular condition is satisfied:
我不确定您究竟想要做什么,但是下面演示了如何在满足特定条件时使用字符串连接来追加“newValue”:
UPDATE [nameOfTable] SET [columnName] += "newValue" where [id]=[value]
更新[nameOfTable] SET [columnName] += "newValue",其中[id]=[value]
#1
44
Without more details, here's a simple example:
没有更多的细节,这里有一个简单的例子:
UPDATE YourTable
SET YourColumn = YourColumn + 'Appended Data'
#2
6
Not sure exactly what you are asking, but here is an example with a table named Names with two columns: id - int, name - nvarchar(max):
不确定您要问的是什么,但是这里有一个例子,表的名称有两个列:id - int, name - nvarchar(max):
update Names
set name = name + ' a string to append'
where id = 2
#3
3
UPDATE YourTable
SET YourColumn += 'Appended Data'
#4
2
I'm not sure what exactly you are trying to do, but the following illustrates how to use string concatenation to append "newValue" when a particular condition is satisfied:
我不确定您究竟想要做什么,但是下面演示了如何在满足特定条件时使用字符串连接来追加“newValue”:
UPDATE [nameOfTable] SET [columnName] += "newValue" where [id]=[value]
更新[nameOfTable] SET [columnName] += "newValue",其中[id]=[value]