日期:2014-05-18 浏览次数:20678 次
if object_id('[user]') is not null drop table [user]
go
create table [user]([用户名] int,[数据] varchar(30))
insert [user]
select 123,'0xAAAAAA1111FFFFF' union all
select 222,'0xBBBBBB1233EEEEE' union all
select 333,'0xCCCCCC5123DDDDD' union all
select 444,'0xDDDDDD8888FFFFF'
go
Update [user]
Set 数据=convert(varbinary(8),stuff(left(数据,len(数据)-5),3,6,'888888')+'99999')
Where 用户名='123'
go
select * from [user]
/**
用户名 数据
----------- ------------------------------
123 0x888888111199999
222 0xBBBBBB1233EEEEE
333 0xCCCCCC5123DDDDD
444 0xDDDDDD8888FFFFF
(4 行受影响)
**/