Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table test
- (
- id int identity(1, 1) not null,
- val varchar(25) not null
- )
- insert into test values ('< <- ok, < <- nok')
- while 1 = 1
- begin
- update test
- set val = left(val, patindex('%<[^;]%', val) - 1) +
- '<' +
- right(val, len(val) - patindex('%<[^;]%', val) - 2)
- from test
- where val like '%<[^;]%'
- IF @@ROWCOUNT = 0 BREAK
- end
- select * from test
- create table test
- (
- id int identity(1, 1) not null,
- val varchar(25) not null
- )
- insert into test values ('< <- ok, < <- nok')
- WHILE 1 = 1
- BEGIN
- UPDATE test SET
- val = STUFF( val , PATINDEX('%<[^;]%', val) + 3 , 0 , ';' )
- FROM test
- WHERE val LIKE '%<[^;]%'
- IF @@ROWCOUNT = 0 BREAK
- END
- select * from test
- s/<(?!;)/</gi
- UPDATE tableName
- SET columName = REPLACE(columName , '<', '<')
- WHERE columnName LIKE '%lt%'
- AND columnName NOT LIKE '%lt;%'
- UPDATE tableName
- SET columName = REPLACE(columName , '<;', '<')
Add Comment
Please, Sign In to add comment