读书人

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

发布时间: 2012-10-31 14:37:31 作者: rapoo

添加一条横杠到某字段里 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

读书人网 >SQL Server

热点推荐