0

我需要能够替换字段中的值,例如 IP - 但这个 IP 会改变。

我尝试使用 CHARINDEX 和 SUBSTRING

    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)

我将如何做,所以它将用文本替换它

例子:

我有 IP [ http://10.10.111.5...]或 [ http://11.11.222.6...]但我需要这样说 - “...//EXAMPLE...”

4

1 回答 1

0

请试试:

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
于 2013-10-28T12:53:24.050 回答