Ben Chuanlong Du's Blog

It is never too late to learn.

Split String into Rows in SQL

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

split

SELECT
    A.state,
    split.A.value('.', 'VARCHAR(100)') AS String
FROM (
    SELECT 
        state,  
        CAST('<M>' + REPLACE(city, ',', '</M><M>') + '</M>' AS XML) AS string  
    FROM
        TableA
    ) AS A
CROSS APPLY String.nodes ('/M') AS split(a)

Improve the Performance of Spark

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Plan Your Work

  1. Have a clear idea about what you want to do is very important, especially when you are working on an explorative project. It often saves you time to …

Questions on SQL

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. 比如在 LEFT JOIN 中过滤条件写在 ON 和 WHERE 的区别。

  2. Table-value function 和 scalar-valued function 的区别.

  3. char、varchar、nvarchar之间的区别(包括 …