Sunday, 15 June 2014

SQL Replace string in path -



SQL Replace string in path -

how replace before "test" blank? amount of subfolders in front end of "test" may vary.

c:\aaa\bbb\test\ccc\ddd

i be:

test\ccc\ddd

solution in mssql, if you're using rdmbs i'm sure have equivalent functions patindex/substring.

declare @path varchar(8000) ,@find varchar(128) set @path = 'c:\aaa\bbb\test\ccc\ddd' set @find = 'test\' select substring(@path,patindex('%'+@find+'%',@path),len(@path))

http://sqlfiddle.com/#!3/d41d8/8576

sql

No comments:

Post a Comment