Skip to content

Instantly share code, notes, and snippets.

@iampeterbanjo
Created March 2, 2011 20:28
Show Gist options
  • Save iampeterbanjo/851678 to your computer and use it in GitHub Desktop.
Save iampeterbanjo/851678 to your computer and use it in GitHub Desktop.
find and remove the new-line character using sql
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
@iampeterbanjo
Copy link
Author

Find a newline character with SQL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment