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

平添一条横杠到某字段里 sql

2012-10-31 
添加一条横杠到某字段里 sql?//--该存储过程的功能是:添加一条横杠到某字段里 例如: ?無限累計達到USD

添加一条横杠到某字段里 sql

?

//--该存储过程的功能是:添加一条横杠到某字段里 例如: ?'無限累計達到USD'===>?'無限累計達到USD_____'?

?

?重点:使用到了Replace函数

?

declare @i int,@ExamID int, @str varchar(50)
set @i = 243
while @i<=255
begin
select? @ExamID=ExamID,@str=Question from exam where examtype='1' and Question like '%無限累計達到%' and ExamID=@i


set @str = REPLACE(@str, '無限累計達到USD???? ', '無限累計達到USD_____')?

update exam
set Question=@str
?where examtype='1' and ExamID=@ExamID

set @i = @i + 1

end

热点排行