點晴模切ERP-sql函數split用于動態校驗導入數據
當前位置:點晴教程→點晴ERP企業管理信息系統
→『 經驗分享&操作答疑 』
![]() ![]() /****** Object: UserDefinedFunction [dbo].[split] Script Date: 2025/7/7 16:05:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE function [dbo].[split](@SourceSql varchar (max),@StrSeprate varchar (10)) returns @temp table( F1 nvarchar (MAX),SPLIT_ID int) as begin declare @start_i int, @row_id int set @row_id=1; set @SourceSql = rtrim(ltrim(@SourceSql)) --去掉左右空格 set @start_i = charindex( @StrSeprate,@SourceSql ) --查詢過濾字符首次出現位置 while @start_i >=1 begin insert @temp values (left(@SourceSql,@start_i - 1),@row_id) set @row_id=@row_id+1; set @SourceSql =substring( @SourceSql, @start_i + len(@StrSeprate), len(@SourceSql) - (@start_i + len(@StrSeprate) - 1)) --去掉已經插入表中的值 set @start_i =charindex( @StrSeprate,@SourceSql ) end if @SourceSql <>'' insert @temp values ( @SourceSql,@row_id) set @row_id=@row_id+1; return end GO ? 點晴模切ERP更多信息:http://moqie.clicksun.cn,聯系電話:4001861886 該文章在 2025/7/9 15:53:39 編輯過 |
關鍵字查詢
相關文章
正在查詢... |