Created
March 2, 2011 20:28
-
-
Save iampeterbanjo/851678 to your computer and use it in GitHub Desktop.
find and remove the new-line character using sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TRIM(TRAILING SUBSTR(value,NEW_LINE_INDEX-1) | |
FROM value) as NEW_VALUE | |
FROM ( | |
SELECT INSTR(value, "\n") | |
AS NEW_LINE_INDEX, | |
value | |
FROM table | |
WHERE value != "" | |
ORDER BY value | |
) findNewLines | |
WHERE NEW_LINE_INDEX > 0 | |
ORDER BY NEW_LINE_INDEX desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Find a newline character with SQL