答案 0 :(得分:3)
试试这个
UPDATE Table x
SET x.dataconv = SUBSTRING(x.dataconv,LEN(x.path),LEN(x.dataconv))
WHERE SUBSTRING(x.dataconv,1,LEN(x.path)) == x.path
答案 1 :(得分:0)
您可以尝试使用替换?
DECLARE @table TABLE (id INT, dataconv VARCHAR(500), [path] VARCHAR(500));
INSERT INTO @table SELECT 1, 'C:\windows test_data_1', 'C:\windows';
INSERT INTO @table SELECT 2, 'C:\windows\test.ini test_data_2', 'C:\windows\test.ini';
INSERT INTO @table SELECT 3, 'C:\word docs\doc.ini test_data_3', 'C:\word docs\doc.ini';
INSERT INTO @table SELECT 4, '/P/TestUser/dfg002/SinglePageCV''s/JoeBloggs.doc33216root;tuser002_admin@IEroot;Domain:Users@IE431104 1330820929 1003750078 1055597658', '/P/TestUser/dfg002/SinglePageCV''s/JoeBloggs.doc';
SELECT id, LTRIM(REPLACE(dataconv, [path], '')) FROM @table;
返回:
1 test_data_1
2 test_data_2
3 test_data_3
4 33216root;tuser002_admin@IEroot;D??omain:Users@IE431104 1330820929 1003750078 1055597658