How to insert a line break in SQL on Snowflake

  • How-Tos FAQs
  • December 17, 2018
 

An easy no-code method way to insert a line break in SQL is with Datameer on Snowflake

With modern tools like Datameer on Snowflake, you can use a singular regular-expression string function to take care of all this.

Cool, right?

To get started, kickstart your Snowflake instance and connect your Datameer account to explore these capabilities today!

A few other ways we can insert a line break in SQL are with MySQL and SQL Server

MySQL

-- Using both \r\n
SELECT 'First line.\r\nSecond Line.' AS 'New Line';
-- Using both \n
SELECT 'First line.\nSecond Line.' AS 'New Line';
-- Using both \r
SELECT 'First line.\rSecond Line.' AS 'New Line';
-- Simply dividing the text into new line
SELECT 'First line.
Second Line.' AS 'New Line';

-- Output for all of the above query
# New Line
-----------------
First line.
Second Line.

SQL Server

-- using new line feed: CHAR(10)
SELECT 'First line.'+ CHAR(10) + 'Second line.' AS 'New Line'

-- using carriage return: CHAR(13)
SELECT 'First line.'+ CHAR(13) + 'Second line.' AS 'New Line'
-- Using both: CHAR(13)+CHAR(10)
SELECT 'First line.'+ CHAR(13)+CHAR(10) + 'Second line.' AS 'New Line'
-- Simply dividing the text into new line
SELECT 'First line.
Second line.' AS 'New Line'

-- Output for all of the above query
# New Line
-----------------
First line.
Second Line.

Up Next:

Read How to join three tables in SQL?