I would like to insert in a table some pieces of code. For example:
table:
create table [tbl_cfg](
[tabid] [int] IDENTITY(1,1) NOT NULL,
cust_code nvarchar(max) NULL
) ON [PRIMARY]
Insert into tbl_cfg(cust_code)
select ' this is the first line
this is the second line'
My problem is that when I do this, sql automatically flatterns my code i.e. any \n is replaced with spaces.
If I insert it with Edit top 200 rows and I just paste the code, only the first line is inserted.
UPDATE:
In order to test this:
select * from tbl_cfg
copy the code and paste it in another window
According my experience about this issue:
Your strings with
\nis still in the original format in sql table, but when you do select it is presented in a single line.However, for example if you put the string to html code, you’ll see
\nis still there.