Skip to content
Advertisement

Get Values between Each Comma in Seperate Row in SQL Server

I need to insert multiple rows in a database table from a single string.

Here is my string it will be comma-seperated values

Current string:

What I want is that batch 1 should be ignored or removed and remaining part should be added into the SQL Server database as a separate row for after each comma like this

Table name dbo.MSISDNData

and when I query the table it should return the results like this

Query :

Results

Advertisement

Answer

Try this:

It demonstrates how to split the data. You may need to sanitize it, too – remove the batch 1, perform trimming, etc.

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