Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return concatenated string from select statement
Message
 
À
09/10/2003 03:54:40
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00836663
Message ID:
00836691
Vues:
10
This message has been marked as the solution to the initial question of the thread.
That's the way to go. The only thing you can do if you are using SQL 2000, is to create a UDF that will concatenate rows and return the concatenation as a varchar.


>I would like to return a concatenated string from a select statement rather than a series of records.
>
>I realise I can just return a table and then convert it into to string myself, but I wondered if there was a SQL Server way of doing this, that return the string as some sort of scalar value.
>
>at present I would have to do the following
>
>Select myfield from mytable
>
>mystring=''
>for i = 1 to reccount
> mstring = myfield + chr(13)
> move to next record
>next i
>
>
>I am trying to remove the code loop above
>
>Many Thanks
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform