We help IT Professionals succeed at work.

CHAR(13)+CHAR(10)

select 'one'+CHAR(13)+CHAR(10)+'two'+CHAR(13)+CHAR(10)+'three'
gives the results as
one  two  three

how can i make it
one  
two  
three
Comment
Watch Question

deightonprog
BRONZE EXPERT

Commented:
select 'one' union select 'two' union select 'three'




but what are you trying to do exactly?
SILVER EXPERT
Most Valuable Expert 2012
Top Expert 2013

Commented:
If you are working with MS Access, change the CHARs to Chr.  Ie:

select 'one' + CHR(13) + CHR(10) + 'two' + CHR(13) + CHR(10) + 'three'

CHR(13) + CHR(10) is carriage return/Linefeed and will give you the vertical breaks shown.

Author

Commented:
deighton, that was a simple example that i gave.. yes, union is a good idea.. but actually the code will inserting one line at a time in a varchar(max) field.. so union won't work there.. we want the result to be listed as separate lines not all together.

Author

Commented:
mbizup, CHR is not in sql. so you get the
1
2
3
output in access with the same logic?
SILVER EXPERT
Most Valuable Expert 2012
Top Expert 2013

Commented:
Yes.  Using an Access UI, your query would be using the VBA Chr() function, and 'stacks' the numbers as displayed.  You would have to change the +'s to &'s, though:


select 'one' & CHR(13) & CHR(10) & 'two' & CHR(13) & CHR(10) & 'three'
BRONZE EXPERT
Top Expert 2012
Commented:
>>select 'one'+CHAR(13)+CHAR(10)+'two'+CHAR(13)+CHAR(10)+'three'
gives the results as
one  two  three<<
That is only because you are viewing it using "Results to Grid", change it to "Results to Text" and you will see it like this:

---------------
one
two
three

(1 row(s) affected)