更新数据库字段其中一部分的语法

 DECLARE @oldPath varchar(480)
select @oldPath = path from CMS_Categories where CategoryID = @CategoryID 
UPDATE CMS_Categories SET Path = STUFF(Path, 1, LEN(@oldPath), @path) where path like @oldPath + '%'

STUFF()函数的用法是将指定字符串(path)从某索引值开始到某索引值这段字符中替换成指定字符串
posted on 2005-10-25 12:38  杜冠魁  阅读(285)  评论(0编辑  收藏  举报