Skip to content
Advertisement

How to separate values with Parse name in SQL Server

I have a value (500 , 850 , 65.5) as GivenUnitPrice and I want to separate these by making separate columns by PARSENAME

I have tried like this

and the result is

Advertisement

Answer

Seems you want to seperate the characters by commas but Parsename() function splits by dot character( e.g. decimal number 65.5 is also splitted as if seperate integers ), so yields wrong results for your case. It’s better to use replace(),substring() and charindex() together as :

Demo

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement