You are here: Re: stored procedure to concatenate column value sin a single cell? « MsSQL Server « IT news, forums, messages
Re: stored procedure to concatenate column value sin a single cell?

Posted by Erland Sommarskog on 01/08/07 08:24

Plamen Ratchev (Plamen@SQLStudio.com) writes:
> Here is one way to accomplish what you need using a function. Be aware of
> the limitation of 8000 characters for varchar. If you are using SQL Server
> 2005 you can use varchar(max) to expand beyond the 8000 character limit.
>...
> SELECT @sReturn = COALESCE(@sReturn + @sDelimiter, '') + col2 FROM Test
> WHERE col1 = @col1 ORDER BY col2


Also beware that this solution relies on undefined behaviour. This may
work - or it may not.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация