首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

数据替换,该怎么处理

2012-04-04 
数据替换在数据库中,如何把替换数据?如手机号为:12345678中的“1”替换为t,“2”替换为p[解决办法]SQL code--1

数据替换
在数据库中,如何把替换数据?如手机号为:12345678中的“1”替换为t,“2”替换为p

[解决办法]

SQL code
--12345678中的“1”替换为t,“2”替换为pdeclare @str intset @str=12345678select     replace(replace(replace( replace(replace(replace(replace(replace(replace(replace(@str,1,'o'),2,'t'),3,'h'),4,'f'),5,'i'),6,'s'),7,'e'),8,'g'),9,'n'),0,'z')----------------------------------------------------------------------------------------------------------------othfiseg(1 行受影响)
[解决办法]
探讨
SQL code
--12345678中的“1”替换为t,“2”替换为p
declare @str int
set @str=12345678
select
replace(replace(replace( replace(replace(replace(replace(replace(replace(replace(@str,1,'o'),2,'t'),3,'h'),4,'f……

热点排行