Hello. When inserting records into the text field of the SQL server table, the text was copied from MS Word. Some inserts were with two or three lines (carriage transfer). Question:
How can I send a request to remove all carriage transfers from the records (make one line from two lines)?
UPD1 :
And instead of moving the carriage put a space.
6 answers
I found the answer to the question. And it is so amazing and extraordinary that everyone just needs to look at it !!!
Here, actually, what's the matter: I tried to put different characters in both SQL Server Management Studio
and MS Access
. And there was no result. And then it struck in my head not to put any characters, but simply in the request, in MS Access
, put the opening quotes on one line, and close on another. And O MIRACLE! The request went as I had to. Here is a screenshot for a clearer understanding:
UPD1 :
In SQL Server Management Studio
, this option also works.
update `mytable` set mytext_field=replace(mytext_field, '\r', ' ');
- Not rolled: (Here is my query: UPDATE dbo_TEMP SET [Text] = replace ([Text], 'r', '')) - Anton Mukhin
- before the letter "r" the slash by the visual editor was cut - turn it around - Farrock
- Also not (Now doesn’t delete anything. I have the
nvarchar(255)
field if it says something. UPDATE dbo_TEMP SET [Text] = replace ([Text], '\ r', '')) - Anton Mukhin - From the options just try \\ n to delete. - Farrock
- Doesn’t help \\ n, $,: Cc, \\ r - Anton Mukhin
UPDATE Table SET [text] = REPLACE([text], CHAR(10) + CHAR(13),' ')
In the same way, you can add a line feed and carriage return to the result of the query, if required, by aggregating the results of working in the cursor, for example.
SELECT @res = @res + CHAR(10) + CHAR(13);
Look in this direction:
REPLACE(ТВОЕ ПОЛЕ, chr(10), '') REPLACE(ТВОЕ ПОЛЕ, chr(13), '')
I worked replace(replace([текст],char(10),''),char(13),'')
- Another missed replace - Qwertiy ♦
- ATP fixed! - EkaterinaSS
- yeah, see, fixed - Qwertiy ♦
- specify what is the SQL dialect pzhlst .. - Drakonoved
- Microsoft sql server - Anton Mukhin
replace (replace (ADDRESS, char (13), ''), char (10), '')
- fourAnd the explanation will be? - Pavel Mayorov
- Welcome to Stack Overflow in Russian! Please try to leave a little more detailed answers. You can add an answer by clicking edit - aleksandr barakin
- @PavelMayorov, and so everything is clear. - Qwertiy ♦