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

paul.hartland at fsmail.net paul.hartland at fsmail.net
Mon Feb 16 03:03:27 CST 2004


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-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the AccessD mailing list