create proc PrintStrArr @Str nvarchar(2000), @Split varchar(1) as declare @PosiInt int declare @StrCopy nvarchar(2000) declare @StrItem nvarchar(200) declare @ErrorNum int set @ErrorNum=0 begin tran if LEN(@Str)>0 begin set @[email protected] while len(@StrCopy)>0 begin set @PosiInt= CHARINDEX(@Split, @StrCopy) if @PosiInt>0 begin set @StrItem=LEFT(@StrCopy,@PosiInt-1) set @StrCopy=RIGHT(@StrCopy,len(@StrCopy)- @PosiInt) Print @StrItem set @[email protected][email protected]@ERROR end else begin set @[email protected] set @StrCopy=‘‘ print @StrItem set @[email protected][email protected]@ERROR end end end if (@ErrorNum<>0) begin rollback tran return 0 end else begin commit tran return 1 end
时间: 2024-10-10 04:46:10