34,594
社区成员
发帖
与我相关
我的任务
分享
update 表 set url=CONCAT(ID , RIGHT(url,5))
update full set url=replace(url,'文件名',id)
declare @T table(ID int,url nvarchar(10))
insert @T select
1, '文件名.html' union all select
3, '文件名.html' union all select
4, '文件名.html' union all select
6, '文件名.html' union all select
7, '文件名.html' union all select
8, '文件名.html'
update @T
set url=rtrim(ID)+'.html'
select * from @T
(所影响的行数为 6 行)
(所影响的行数为 6 行)
ID url
----------- ----------
1 1.html
3 3.html
4 4.html
6 6.html
7 7.html
8 8.html
(所影响的行数为 6 行)
declare @T table(ID int,url nvarchar(10))
insert @T select
1, '文件名.html' union all select
3, '文件名.html' union all select
4, '文件名.html' union all select
6, '文件名.html' union all select
7, '文件名.html' union all select
8, '文件名.html'
select ID,rtrim(ID)+right(url,charindex('.',reverse(url))) as 显示
from @t
declare @T table(ID int,url nvarchar(10))
insert @T select
1, '文件名.html' union all select
3, '文件名.html' union all select
4, '文件名.html' union all select
6, '文件名.html' union all select
7, '文件名.html' union all select
8, '文件名.html'
update @T
set url=rtrim(ID)+right(url,charindex('.',reverse(url)))
select * from @t
(所影响的行数为 6 行)
(所影响的行数为 6 行)
ID url
----------- ----------
1 1.html
3 3.html
4 4.html
6 6.html
7 7.html
8 8.html
(所影响的行数为 6 行)