[AccessD] [dba-VB] Concatenating Fields In SQL Stored Procedure OrSQL View

Arthur Fuller artful at rogers.com
Sun Feb 22 21:47:05 CST 2004


In SQL 2K this is relatively trivial. Write a UDF that does a bunch of
IsNull()s. In SQL 7 it is more complex but essentially the same op.
Write a bunch of IsNull()s and CASE WHEN them.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
paul.hartland at fsmail.net
Sent: Monday, February 16, 2004 1:03 AM
To: SQL Group
Cc: accessd; dba-vb
Subject: [AccessD] [dba-VB] Concatenating Fields In SQL Stored Procedure
OrSQL View


To all,
 
I have a table in SQL Server 7.0 called tblClient with the following
fields of information:
            BranchNo
            BranchCode
            ClientName
            Addrs1
            Addrs2
            District
            Town
            County
            Postcode
            Telephone
 
I want the following fields ClientName, Addrs1, Addrs2, District, Town,
County, Postcode to appear as one line separated by a comma like below
 
BranchNo           BranchCode       Address
9999029            B&Q9999029      ClientName, Addrs1, District, Town,
Postcode
 
As you can se from the example Addrs2 and County are missing, this is
because these are blank sometimes.  I have tried a couple of ways but
always end up with the following
 
BranchNo           BranchCode       Address
9999029            B&Q9999029      ClientName, Addrs1, , District, Town,
, Postcode
 
As you can see where the missing fields are the comma’s still appear.
Any help on this will be gratefully received.
 
Paul Hartland
Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a
month 
www.freeserve.com/anytime
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list