This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a SQL Interview questions for Database Developer. If you are database fresher and working with SQL, you must prepare for string/date operations related questions and answers.
One of the example questions is How to remove New Line Character from a string?
Check the below sample code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
DECLARE @str VARCHAR(100) SET @str = 'I am Database Engineer' SELECT @str AS With_New_Line With_New_Line --------------------- I am Database Engineer SELECT REPLACE(REPLACE(@str, CHAR(13), ''), CHAR(10), '') AS Without_New_Line Without_New_Line --------------------------- I am Database Engineer |
Leave a Reply