Home > Archive > MS SQL XML > December 2006 > Retrieve records separated by spaces









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Retrieve records separated by spaces
Han

2006-12-01, 7:17 pm

Hello

I want to retrieve some records separated by spaces. Do you have any idea?

For example,

select col from T for xml path(''), root('x')

You get

<x>
<col>abc</col>
<col>def</col>
.......
</x>

However I want to get,

<x>abc def ghi ... </x>


Han

2006-12-01, 7:17 pm

After post I got an idea, but looking for better one.

select @x=(select col from T for xml path(''))

select @x.query('
for $a in /col
return (concat(/$a/text(), " "))
')
for xml path

Any idea will be appreciated.

"Han" <hp4444@kornet.net.korea> wrote in message
news:%233fljmVFHHA.4652@TK2MSFTNGP04.phx.gbl...
> Hello
>
> I want to retrieve some records separated by spaces. Do you have any idea?
>
> For example,
>
> select col from T for xml path(''), root('x')
>
> You get
>
> <x>
> <col>abc</col>
> <col>def</col>
> ......
> </x>
>
> However I want to get,
>
> <x>abc def ghi ... </x>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com