更新字串列表中,指定位置的字串

2021-04-14 11:36:48 字數 972 閱讀 2134

if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[f_updatestr]') and xtype in (n'fn', n'if', n'tf'))

drop function [dbo].[f_updatestr]

go/*--更新字串列表中,指定位置的字串

更新字串列表中,指定位置的字串為新的值

如果位置超出範圍,則不做更新

--鄒建 2004.07(引用請保留此資訊)--*/

/*--呼叫示例

select dbo.f_updatestr('001|002|003|',1,'00a','|')

--*/

create function f_updatestr(

@s varchar(8000),

@pos int,

@newstr varchar(100),

@spliststr varchar(10) --字串列表的分隔符

更新字串列表中,指定位置的字串

if exists select from dbo.sysobjects where id object id n dbo f updatestr and xtype in n fn n if n tf drop function dbo f updatestr go 更新字串列表中,指定位置的字串...

更新字串列表中,指定位置的字串

if exists select from dbo.sysobjects where id object id n dbo f updatestr and xtype in n fn n if n tf drop function dbo f updatestr go 更新字串列表中,指定位置的字串...

更新字串列表中,指定位置的字串

if exists select from dbo.sysobjects where id object id n dbo f updatestr and xtype in n fn n if n tf drop function dbo f updatestr go 更新字串列表中,指定位置的字串...