

For example: SELECT CustomerID, FirstName, LastName, These two specific codes represent the characters of the line break. Indeed, use the simple replace function and the CHAR(13) and CHAR(10) codes. Remove SQL Server new line feeds with REPLACE To go further, this is the SQL Server REPLACE built-in function documentation. You notice that the address contains two line breaks, as in the INSERT statement: 123, Then, if you copy and paste the AddressText column from the SQL Server result. INSERT INTO dbo.CUSTOMERS ( FirstName, LastName, AddressText, Countr圜ode, CountryName )


Insert first sales amount for each month WHERE object_id = object_id(N'dbo.CUSTOMERS') We are splitting here the address column into three different lines. Prepare a table with sample dataįirst, let’s prepare a table with some sample data that contains line breaks. The solution is to remove them directly from the SQL Server query. You don’t have the same number of columns and lines anymore in your Excel file! These line breaks are often an issue in very large files because they are tricky to find and to fix. The table is not structured as wanted because every line break creates a new line. And of course, results are wrong because the columns are shifted. The Excel sheet displays not aligned data, different from the original query result.
