Search
 
SCRIPT & CODE EXAMPLE
 

SQL

split string from comma in sql

SELECT value FROM tbl_RuralPopulation CROSS APPLY STRING_SPLIT(panchCode, ','))
Comment

split string by comma in sql server

CREATE FUNCTION Split
(
  @delimited nvarchar(max),
  @delimiter nvarchar(100)
) RETURNS @t TABLE
(
-- Id column can be commented out, not required for sql splitting string
  id int identity(1,1), -- I use this column for numbering splitted parts
  val nvarchar(max)
)
AS
BEGIN
  declare @xml xml
  set @xml = N'<root><r>' + replace(@delimited,@delimiter,'</r><r>') + '</r></root>'

  insert into @t(val)
  select
    r.value('.','varchar(max)') as item
  from @xml.nodes('//root/r') as records(r)

  RETURN
END
GO
Comment

sql split comma separated string into rows

sql split string
Comment

PREVIOUS NEXT
Code Example
Sql :: update set table column to null 
Sql :: difference between normalization and denormalization 
Sql :: substring sql 
Sql :: sql update record 
Sql :: sql unique select 
Sql :: how to force truncate a table in mysql 
Sql :: on update current_timestamp jpa 
Sql :: EnvironmentError: mysql_config not found 
Sql :: declare temp table in sql 
Sql :: sql server: how to concatenate column data using comma 
Sql :: FIND LOWEST SALARY EARNER IN SQL 
Sql :: create unique constraint postgres 
Sql :: oracle alter table add column 
Sql :: return the number of records in a single table mysql 
Sql :: query to find third highest salary 
Sql :: nested query sql 
Sql :: replace content value from old to new sql 
Sql :: unique element in sql 
Sql :: docker hub mysql 
Sql :: create postgres table 
Sql :: insert data from one database table to another database table in postgresql using pgadmin 
Sql :: sql drop all tables 
Sql :: not keyword in sql 
Sql :: get specific column in mongodb 
Sql :: openquery join two tables 
Sql :: SQL Server modify_timestamp trigger 
Sql :: SQL SELECT TOP Equivalent in oracal 
Sql :: MySql Subtract a table from another 
Sql :: last date for each user sql 
Sql :: sql max value in column 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =