2 may
2021

Breakline in ssis message does not work

I am creating a message inside a string using a Script task

The code would look like this:

Message = Description +"\n" + Message;

The idea is to receive a message like this:

Description
Description

and so on

Within a messagebox I can see this result, but when I open the mail, the message is composed of one single line:

Description1  Description2

I have also changed "\n" for "\n\r", Environment.NewLine. But it didn't work.

Could you explain me what am I doing wrong?

COMENTARIOS

Abhijeet Patil

You need to typecast it as below:

(DT_STR,2,1252)"\r\n"

For example...the below expression in Execute SQL task is dynamic SQL

"INSERT INTO [dbo].[OBJ_COUNT]([OBJ_NAME], [OBJ_COUNT]) VALUES ( " + "'EMPLOYEE_MASTER', " + (DT_STR, 10, 1252) (@[User::EMP_MAST_COUNT])+" );" + (DT_STR,2,1252)"\r\n" + "GO " + (DT_STR,2,1252)"\r\n" + "INSERT INTO [dbo].[OBJ_COUNT]([OBJ_NAME], [OBJ_COUNT]) VALUES ( " + "'DEPT_MASTER', " + (DT_STR, 10, 1252) (@[User::DEPT_MAST_COUNT])+" );" + (DT_STR,2,1252)"\r\n"+ "GO "

And will give output as below...

INSERT INTO [dbo].[OBJ_COUNT]([OBJ_NAME], [OBJ_COUNT]) VALUES ( 'EMPLOYEE_MASTER', 2514);
GO 

INSERT INTO [dbo].[OBJ_COUNT]([OBJ_NAME], [OBJ_COUNT]) VALUES ( 'DEPT_MASTER', 2541);
GO 

jayt.dev

Try "\n\n" . This works but adds an extra line break. In most cases it is adequate.

DEJA TU COMENTARIO

© 2017 website by Rubit Corporation