July 9, 2018 at 8:38 am
Raghavender Chavva - Monday, July 9, 2018 8:26 AMWhen I executed this code in SQL Server 2016, below is the error:Procedure expects parameter 'separator' of type 'nchar(1)/nvarchar(1)'
Precisely why all of the discussion above says that the question lists an incorrect answer. π
--Jeff Moden
Change is inevitable... Change for the better is not.
July 9, 2018 at 9:08 am
I suspect a lot of people on here have their own split functions that behave just like the purported correct answer, I assumed the question was designed to show the short comings of String_Split().
How many people are still using homegrown (or "Google Found") split functions whilst eagerly awaiting the next version of String_Split?
July 9, 2018 at 9:11 am
I got the "correct" wrong answer simply because I made the faulty assumption that SQL Server would simply use the 1st character and "shave off" any subsequent characters... like it does everywhere else...
DECLARE
@cars VARCHAR (200) = 'Porsche, Ferrari, Bentley, Jaguar,Range Rover',
@delim NCHAR (1) = N', ';
SELECT
value
FROM
STRING_SPLIT(@cars, @delim);
or
DECLARE @cars VARCHAR (200) = 'Porsche, Ferrari, Bentley, Jaguar,Range Rover';
SELECT * FROM dbo.DelimitedSplit8K(@cars, ', ') dsk;
Way to be consistent Microsoft... π
July 9, 2018 at 9:11 am
Ah, ticked the wrong checkbox on my side. My apologies. Awarding back points.
July 9, 2018 at 9:40 am
I couldn't, for the life, of me work out why Jeff and Eirikur had a problem with the question yesterday, as I answered it on my phone. Turns out that the space is practically invisible on my phones browser, as the font loses its fixed width. >_<
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
July 9, 2018 at 10:04 am
I didn't know how to showcase the space in there well. Maybe I need to add a note that the parameter is comma, space?
July 9, 2018 at 10:08 am
Steve Jones - SSC Editor - Monday, July 9, 2018 10:04 AMI didn't know how to showcase the space in there well. Maybe I need to add a note that the parameter is comma, space?
It's fine on PC, which is more likely what people will; be viewing it on; it just making (almost) invisible on my Pixel.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
July 9, 2018 at 11:36 am
Thom A - Monday, July 9, 2018 9:40 AMI couldn't, for the life, of me work out why Jeff and Eirikur had a problem with the question yesterday, as I answered it on my phone. Turns out that the space is practically invisible on my phones browser, as the font loses its fixed width. >_<
He he, didn't have a problem with the question π
π
Questions are never a problem, answers, on the other hand, can be problematic.
July 9, 2018 at 10:52 pm
Reading through the discussion i'm glad i only got to answer this today (still trying to catch up after the week away)....
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
βlibera tute vulgaris exβ
Viewing 9 posts - 16 through 23 (of 23 total)
You must be logged in to reply to this topic. Login to reply