SQL替换为更改值
我需要能够替换一个字段中的值,例如I.p-但是这个I.p会改变 我尝试使用CHARINDEX和子字符串SQL替换为更改值,sql,sql-server,replace,Sql,Sql Server,Replace,我需要能够替换一个字段中的值,例如I.p-但是这个I.p会改变 我尝试使用CHARINDEX和子字符串 case when cr.DateOfCall between convert(varchar, getdate(), 112) and convert(varchar, getdate() +1, 112) then '\\10.10.111.5\Recordings\***\' + substring(***, charindex
case when cr.DateOfCall between convert(varchar, getdate(), 112) and convert(varchar, getdate() +1, 112) then
'\\10.10.111.5\Recordings\***\' +
substring(***, charindex('\201', ***) + 1, 100)
我将如何做,以便它将替换为文本
例如:
我有I.p[或[但我需要它说-“../EXAMPLE…”请尝试:
declare @tbl as table(Col nvarchar(max))
insert into @tbl values ('http://10.10.111.5/xyz/as.c')
insert into @tbl values ('http://11.11.222.6/asdf/hhl/as.c')
select Stuff(Col, charindex('//', Col, 0)+2, charindex('/', replace(Col, '//', ''), 0)-charindex('//', Col, 0), 'EXAMPLE')
From @tbl
您需要值
http://10.10.111.5/xyz/as.c
ashttp://EXAMPLE/xyz/as.c
?问题不清楚。顺便问一下,为什么在这里将日期转换为varchar?