I want to do a new line in my sql select
I try this but it won't work
SELECT '1' + char(13) + '2'
AND
SELECT '1' + char(13) + char(10) + '2'
it always return 12
thanks for your answers in fact I try to export data from sql to TXT file but when I execute the bcp file it return concatenate rows
That's just the way SSMS displays the results. If you copy the result out into Notepad, or as Lamak says choose Results to Text
you should see the newlines in place.
The new line is in your result. If you copy and paste the result from your query into notepad, for example, you'll see 1, new line, 2. The reason you see 1 2
in your result in the results window is because you are returning 1 row. Notice that len('1' + char(13) + char(10) + '2') = 4, that is because your chars are present, it's just represented as a single row (with multiple lines in the row).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.