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 :: sql insert multiple rows 
Sql :: sql server change schema of a table 
Sql :: mysql backup table 
Sql :: mysql record group by created date count 
Sql :: left join in codeigniter query builder 
Sql :: check lock on table in sql server 
Sql :: connect mysql command line 
Sql :: postgres create column with default value 
Sql :: restore database postgresql 
Sql :: drop a recordin sql 
Sql :: rename table sql server 
Sql :: sql list dates between two dates 
Sql :: DATEDIFF minute postgres 
Sql :: nullif postgresql 
Sql :: mysql select date range last 30 days 
Sql :: update join sql 
Sql :: sql email Regex 
Sql :: sql if clause within where clause 
Sql :: primary key multiple colums 
Sql :: psql load dump 
Sql :: sql function to add all values round of 2 decimal places 
Sql :: sql format time 
Sql :: Converting mysql tables to charset utf8mb4 
Sql :: check database sessions oracle 
Sql :: dump heroku database to sql 
Sql :: SQL Database backup history 
Sql :: oracle nvl 
Sql :: mysql get date from datetime 
Sql :: sql delimiter to columns 
Sql :: how to run a function in sql 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =