我创建了从字符串中删除数字的函数
create function RemoveNumber(@inp nvarchar(50))
returns nvarchar(50)
as
begin
declare @out varchar(50)
if (@inp is NOT NULL)
begin
set @out = ''
while (@inp <> '')
begin
if (@inp like '[0-9]%')
set @out = @out + substring(@in, 1, 1)
set @inp = substring(@inp, 2, len(@in) - 1)
end
end
return(@out)
end
然后我想在触发器中使用它
create trigger ut_RemoverName
on Worker
for insert
as
update Worker
set name = ut_RemoveNumber(name)
它没有看到功能。但是如何从触发器内部的 RemoveNumber 创建循环?(字段name
- nvarchar(10)
)