Here how we can enter date from multiple selection in
text box and split it into separate column level
DECLARE @Dates as varchar(500)='2015-11-08,2015-11-07,2015-11-06,2015-11-05,2015-11-04,2015-11-03,2015-11-02'
DECLARE @totalLength as int=LEN(@dates)+1
DECLARE @intStartposition int=1
DECLARE @intEndposition int=CHARINDEX(',',@Dates)
WHILE @intStartposition <
@totalLength
BEGIN
IF @intEndposition =
0
SET @intEndposition = @totalLength
SELECT SUBSTRING(@Dates,@intStartposition,@intEndposition-@intStartposition)
SET @intStartposition =
@intEndposition+1
SET @intEndposition =
CHARINDEX(',', @Dates, @intStartposition)
PRINT @intStartposition
PRINT @intEndposition
END
I hope it will help you.
Comments