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