Link to home
Start Free TrialLog in
Avatar of 25112
25112

asked on

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
Avatar of deighton
deighton
Flag of United Kingdom of Great Britain and Northern Ireland image

select 'one' union select 'two' union select 'three'




but what are you trying to do exactly?
Avatar of mbizup
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.
Avatar of 25112
25112

ASKER

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.
Avatar of 25112

ASKER

mbizup, CHR is not in sql. so you get the
1
2
3
output in access with the same logic?
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'
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial