MySQL Forums
Forum List  »  General

Works in MSSQL, how to make it work in MySQL?
Posted by: Robert Wiglesworth
Date: August 12, 2015 12:49PM

I have the following code that I have been using in MSSQL that takes a column with comma separated values and returns them on their own lines. It does not work for me in MySQL and I am not familiar enough with MySQL to know if it is just impossible or if a couple little changes will make it work.

SELECT A.[id],
Split.a.value('.', 'VARCHAR(100)') AS String
FROM (SELECT [id],
CAST ('<M>' + REPLACE([cities], ',', '</M><M>') + '</M>' AS XML) AS String
FROM dbo.citiestest where cities like '%,%') AS A CROSS APPLY String.nodes ('/M') AS Split(a);

Thanks for taking a look and letting me know what you think.

Options: ReplyQuote


Subject
Written By
Posted
Works in MSSQL, how to make it work in MySQL?
August 12, 2015 12:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.