Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 更改列的特定数据_Sql_Sql Server_Sql Server 2008 - Fatal编程技术网

Sql 更改列的特定数据

Sql 更改列的特定数据,sql,sql-server,sql-server-2008,Sql,Sql Server,Sql Server 2008,我有一个表,其中有10条记录,现在我想更新特定的列数据,这意味着一些部分,一些列数据和一些非列数据,例如在第1行中,我想用标准更改std,其他数据将保持不变,在单个查询中更改所有行中的相同内容。这可能吗?请记住,我们不能再次删除和添加单元格,因为它将更改id id - col1 - col2 1 - A - std abcad 2 - B - std bcddsad 3 - C - std avadsad 4 - A - std abcdsad 5 - B - std bcddsa 6 - C

我有一个表,其中有10条记录,现在我想更新特定的列数据,这意味着一些部分,一些列数据和一些非列数据,例如在第1行中,我想用标准更改std,其他数据将保持不变,在单个查询中更改所有行中的相同内容。这可能吗?请记住,我们不能再次删除和添加单元格,因为它将更改id

id - col1 - col2

1 - A - std abcad
2 - B - std bcddsad
3 - C - std avadsad
4 - A - std abcdsad
5 - B - std bcddsa
6 - C - std avadsad
7 - A - std abcdsd
8 - B - std bcddsds
9 - C - std avadsd
您可以为此使用该函数

Update
    table
Set
    col2 = Replace(col2, 'std', 'standard');

等等,我去查一下。
UPDATE tblName

SET Column .WRITE('Standard',(CHARINDEX('std',Column,1)-1),LEN('std'))