DECLARE @timeRange as varchar(max)
SET @timeRange= '00:30-01:00**00:20-01:00'
DECLARE @tblTime TABLE(RowNum int identity(1,1),TimeRange ntext)
INSERT INTO @tblTime SELECT rtrim(ltrim(items)) from split(@timeRange,'**')
select *from @tblTime
上記の手順は、中央が null である 3 つの行を返します
と
DECLARE @timeRange as varchar(max)
SET @timeRange= '00:30-01:00*00:20-01:00'
DECLARE @tblTime TABLE(RowNum int identity(1,1),TimeRange ntext)
INSERT INTO @tblTime SELECT rtrim(ltrim(items)) from split(@timeRange,'*')
select *from @tblTime
上記のコードは、まさに私が望んでいた 2 つの行を返しています。
split() 関数が結果に影響する理由を知りたいです。
最初に文字列を**
連結してから分割しましたが、結果は で連結された文字列とは異なります*
。EDITED:分割機能はSageFrameからのものです