标签: sql sql-server tsql sql-server-2005
起初我试过了:
update myTable set myColumn = replace(myColumn,';','')
但是数据中间的数据可能有效;。之前:
;
myColumn not;trailing not;trailing and trailing; trailing;
后:
myColumn not;trailing not;trailing and trailing trailing
答案 0 :(得分:2)
在这种情况下,您可以充分利用left(或substring)和len:
left
substring
len
update myTable set myColumn = left(myColumn, len(myColumn) - 1) where myColumn like '%;'