日期:2014-05-18 浏览次数:20435 次
select '0'+ltrim(cast(rand()*16 as int)+820)
------解决方案--------------------
select coloo1 from 表 where substring(coloo1,12,4) >='0820' and substring(coloo1,12,4) <='0835'
------解决方案--------------------
create table tb(COL001 varchar(64)) insert tb select '0012008010106003707887204090' union all select '0012008010106481205201966090' union all select '0012008010107464207861626090' union all select '0012008010107474403140821090' union all select '0012008010106003707887204090' union all select '0012008010106481205201966090' union all select '0012008010107464207861626090' union all select '0012008010107474403140821090' union all select '0012008010107474614168049090' update tb set col001=stuff(COL001, 12, 4, right(10000+abs(checksum(newid()))%16+820, 4)) select * from tb /* COL001 ---------------------------- 0012008010108203707887204090 0012008010108311205201966090 0012008010108244207861626090 0012008010108214403140821090 0012008010108203707887204090 0012008010108351205201966090 0012008010108344207861626090 0012008010108354403140821090 0012008010108264614168049090 (9 row(s) affected) */ drop table tb