SQL Server 字符串截取

原文:https://blog.csdn.net/lanxingbudui/article/details/87979290



效果1

select RIGHT('SqlServer_2008', 3)



效果2

select RIGHT('SqlServer_2008', LEN('SqlServer_2008')-3)

实际使用

UPDATE dbo.Projects
SET ProjectCode = RIGHT(ProjectCode, LEN(ProjectCode)-6)

效果

还有一个树的层级,降级处理

UPDATE dbo.Projects
SET [Level] = [Level] - 2

效果

原文地址:https://www.cnblogs.com/guxingy/p/13723789.html