【发布时间】:2022-01-22 16:31:27
【问题描述】:
我在表格中有一个 URL 列,下面是 URL。我想删除 Location 之后的字符串。
https://xyz.sharepoint.com/sites/tender/lp/46/Lists/PlaceDetails/Location3
https://xyz.sharepoint.com/sites/tender/lp/50/Lists/PlaceDetails/Location2/4_.000
https://xyz.sharepoint.com/sites/tender/lp/52/Lists/PlaceDetails/Location5
https://xyz.sharepoint.com/sites/tender/lp/50/Lists/PlaceDetails/Location6/8_.000
预期输出
https://xyz.sharepoint.com/sites/tender/lp/46/Lists/PlaceDetails/Location3
https://xyz.sharepoint.com/sites/tender/lp/50/Lists/PlaceDetails/Location2
https://xyz.sharepoint.com/sites/tender/lp/52/Lists/PlaceDetails/Location5
https://xyz.sharepoint.com/sites/tender/lp/50/Lists/PlaceDetails/Location6
尝试使用charindex,但未能成功。任何建议将不胜感激。
【问题讨论】:
-
根据您的样本数据,
Left(url, 74)就足够了。但是我怀疑它比这更微妙。你能调整你的样本数据来说明吗? -
根据问题指南,请展示您的尝试并告诉我们您发现了什么(在本网站或其他地方)以及为什么它不能满足您的需求。
标签: sql sql-server tsql