views:

116

answers:

1

Hi there,

I understand how ALLOW_NEWLINE works. However I don't understand why the option is there in the first place. I would have thought that having it on permanently would be more useful rather than not. Then you can control when you want newlines to appear by inserting "\n" in your code.

Can anyone explain why the option is there? Is it more computationally expensive when turned on?

Many thanks

Andrew

+2  A: 

There are a couple of reasons:

  1. The SQL standard does not allow newlines in the middle of strings - you have to work moderately hard to get a newline into an SQL string.

  2. For most people, most of the time, a newline in a string indicates an error - a forgotten matching close quote.

Consequently, the default hews close to the standard and prevents silly typos from becoming confusing. However, in the absence of other ways to get newlines into character strings, the feature is necessary.

Jonathan Leffler