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
The above procedure is returning three rows with the middle being null
And
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
The above code is returning two rows exactly what I wanted.
I'd like to know why the split() function affects my result.
I have concatenated string with **
first then split, the result is different from the string concatenated with *
.
EDITED: the split function is from SageFrame