Re: Concat tables into one row in view
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 07:29:48 +0000 (UTC)
M@ (mattcushing@xxxxxxxxx) writes:
found a really good alternative on sqlteam.com
USE Northwind
GO
CREATE FUNCTION dbo.ConcatOrderProducts(@OrderID int)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @Output VARCHAR(8000)
SELECT @Output = COALESCE(@Output+', ', '') + CONVERT(varchar(20),
P.ProductName)
Beware! The correct result of this operation is not defined! You may get
what you want, you may get something else! It works most of the time,
but there is no guarantee!
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
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
.
- References:
- Concat tables into one row in view
- From: M@
- Re: Concat tables into one row in view
- From: Erland Sommarskog
- Re: Concat tables into one row in view
- From: M@
- Concat tables into one row in view
- Prev by Date: Re: How to find the maximum possible value of a given datatype
- Next by Date: Re: Strange performance issue with UPDATE FROM
- Previous by thread: Re: Concat tables into one row in view
- Next by thread: Free client
- Index(es):
Relevant Pages
|