日期:2014-05-17 浏览次数:20464 次
----------------------------
-- Author :DBA_Huangzj(發糞塗牆)
-- Date :2013-05-13 16:35:18
-- Version:
-- Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)
-- Jun 17 2011 00:54:03
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1, v.721)
--
----------------------------
--> 测试数据:[u_mtrldef]
if object_id('[u_mtrldef]') is not null drop table [u_mtrldef]
go
create table [u_mtrldef]([序号] int,[configname] varchar(45))
insert [u_mtrldef]
select 1,'阿萨德哈ABV楼上的' union all
select 2,'长得丑法规啊是左旋ca卡极度风格拉格的疯ABV狂了' union all
select 3,'想常晓娟,在vkxcvxhcv走向成功也逐渐形成ABV'
--------------开始查询--------------------------
select REPLACE([configname],'ABV','BC')
from [u_mtrldef]
----------------结果----------------------------
/*
----------------------------------------------------------------------------------------------------------------
阿萨德哈BC楼上的
长得丑法规啊是左旋ca卡极度风格拉格的疯BC狂了
想常晓娟,在vkxcvxhcv走向成功也逐渐形成BC
*/
declare @d nvarchar(100)
set @d = 'abcABVdeadfe'
select replace(@d,'ABV','BC')