日期:2014-05-19  浏览次数:20625 次

看看`大哥们?
例:
A         B         C
a         1         2
b         2         3
c         3         4
1d       5         6
1e       6         7
1f       8         9
怎么不上表变成(下):
A         B         C
1a       1         2
1b       2         3
1c       3         4
1d       5         6
1e       6         7
1f       8         9


------解决方案--------------------
create table T(A varchar(10), B int, C int)
insert T select 'a ' , 1, 2
union all select 'b ' , 2, 3
union all select 'c ' , 3, 4
union all select '1d ', 5, 6
union all select '1e ', 6, 7
union all select '1f ', 8, 9

update T set A= '1 '+A
where charindex( '1 ', A) <> 1

select * from T

--result
A B C
---------- ----------- -----------
1a 1 2
1b 2 3
1c 3 4
1d 5 6
1e 6 7
1f 8 9

(6 row(s) affected)