Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New line in Sql Query

Tags:

sql

How you get new line or line feed in Sql Query ?

like image 224
KuldipMCA Avatar asked Jul 06 '09 06:07

KuldipMCA


People also ask

What does \n mean in SQL?

The "N" prefix stands for National Language in the SQL-92 standard, and is used for representing Unicode characters.

How do I cut a new line character in SQL?

Remove and Replace Carriage Returns and Line Breaks in SQL Using SQL to remove a line feed or carriage return means using the CHAR function. A line feed is CHAR(10); a carriage return is CHAR(13).

How do you jump to a line in SQL?

If this feature is not turned and you need to go to a particular line number press CTRL + G to open the Go To Line dialog box, enter line number and click OK as shown below.

Do new lines matter in SQL?

Yes, it is perfectly fine to add newlines ( \n or \r\n ) to your query. Most parsers consider newlines as whitespace (just like a space or tab), and so does the one used by Oracle (and all other database I have used).


1 Answers

Pinal Dave explains this well in his blog.

http://blog.sqlauthority.com/2009/07/01/sql-server-difference-between-line-feed-n-and-carriage-return-r-t-sql-new-line-char/

DECLARE @NewLineChar AS CHAR(2) = CHAR(13) + CHAR(10) PRINT ('SELECT FirstLine AS FL ' + @NewLineChar + 'SELECT SecondLine AS SL') 
like image 88
Santosh Chandavaram Avatar answered Oct 09 '22 08:10

Santosh Chandavaram