25112
asked on
CHAR(13)+CHAR(10)
select 'one'+CHAR(13)+CHAR(10)+'t wo'+CHAR(1 3)+CHAR(10 )+'three'
gives the results as
one two three
how can i make it
one
two
three
gives the results as
one two three
how can i make it
one
two
three
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.
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.
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.
ASKER
mbizup, CHR is not in sql. so you get the
1
2
3
output in access with the same logic?
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'
select 'one' & CHR(13) & CHR(10) & 'two' & CHR(13) & CHR(10) & 'three'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
but what are you trying to do exactly?