SQL Insert with line break

Asked

Viewed 2,038 times

3

With this command SQL enter some data in the table, the problem is, in the system the field "ANDAMENTOS_PROCESSUAIS.OBSERVATION" is with line breaking and at the time of saving via SQL the line break is lost.

Would you be able to do that SQL insert without losing the line break? How would it be?

INSERT INTO ANDAMENTOS_PROCESSUAIS
    (ANDAMENTOS_PROCESSUAIS.CODIGO_ANDAMENTO,
     ANDAMENTOS_PROCESSUAIS.DESCRICAO_ANDAMENTO,
     ANDAMENTOS_PROCESSUAIS.OBSERVACAO,
     ANDAMENTOS_PROCESSUAIS.NUMERO_PROCESSO,
     ANDAMENTOS_PROCESSUAIS.NUMERO_PROCESSO_AUX,
     ANDAMENTOS_PROCESSUAIS.INSTANCIA,
     ANDAMENTOS_PROCESSUAIS.ACESSO_PUBLICO,
     ANDAMENTOS_PROCESSUAIS.EMAIL_ENVIADO,
     ANDAMENTOS_PROCESSUAIS.CODIGO_PUBLICACAO,
     ANDAMENTOS_PROCESSUAIS.CODIGO_AUDIENCIA,
     ANDAMENTOS_PROCESSUAIS.CODIGO_AGENDAMENTO,
     ANDAMENTOS_PROCESSUAIS.DATA,
     ANDAMENTOS_PROCESSUAIS.HORA)
VALUES
    (CODIGO_ANDAMENTO,
     DESCRICAO_ANDAMENTO,
     OBSERVACAO,
     NUMERO_PROCESSO,
     NUMERO_PROCESSO_AUX,
     INSTANCIA,
     ACESSO_PUBLICO,
     EMAIL_ENVIADO,
     CODIGO_PUBLICACAO,
     CODIGO_AUDIENCIA,
     CODIGO_AGENDAMENTO,
     DATA,
     HORA);

2 answers

3


Take a look at the Documentation of Firebird and seeing the response of @Pedro Cardoso

--CHAR(13) - Quebra de Linha
--CHAR(10) - Mudança de Linha

DECLARE @texto NVARCHAR(100)
SET @texto = 'Esta e a linha numero um.' + CHAR(13) + CHAR(10) + 'Esta e a linha numero dois.'
SELECT @texto

The Corresponding to the Firebird of

  • CHAR(13) is the ASCII_CHAR(13)
  • CHAR(10) is the ASCII_CHAR(10) With this, just assemble your SQL Query as best suits you.

Obs Command and String separation in Firebird must be by || and not with +

  • I’ll try here and see if it works...

2

E SQL 2016 ?

If yes you have to check the SSMS options -> Query Results -> Results to grid -> Reain CR/LF.

If you don’t check if this helps you:

--CHAR(13) - Quebra de Linha
--CHAR(10) - Mudança de Linha

DECLARE @texto NVARCHAR(100)
SET @texto = 'Esta e a linha numero um.' + CHAR(13) + CHAR(10) + 'Esta e a linha numero dois.'
SELECT @texto
  • Explain better because I’m not very good with sql and I don’t understand right '()

  • You need to replace "Enter" with CHAR(13)+CHAR(10) on the variable before doing Insert.

  • @Eduardomendonçadasilva #13 and #10 are the codes ASCII for "break line" Pedro is suggesting you inject a line break code in the middle of the text

  • I’m using Delphi 10.2 and Firebird as it would be for the Firebird?

  • We are talking about pure SQL, I do not know these languages.

  • You asked the question to SQL @Eduardomendonçadasilva...

  • sql - Because it is an Sql command sql-insert - Because it’s about Insert firebird - Because it is in the Firebird database. is just a look at the tags

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.