Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2008, 05:21 PM
Authorized User
 
Join Date: Jul 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default Coalesce and replace function

hi there
I am trying to use the coalsce and replace function to extract thre fields into one (address) but am a little stuck.
This is my query but I keep getting an error when trying to pars it.

select
pt_serial,
coalesce(replace(pt_address_1, ',', ' ') + coalesce(replace(pt_address_2, ',', ' ') + coalesce(replace(pt_address_3, ',', ' ')) as pt_address
from plots

order by pt_serial

can anyone help please.

Thanks

Greg

 
Old May 15th, 2008, 07:59 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Greg,

You haven't posted any data to test against and you haven't posted the error you're getting. My mind reading powers are just a bit weak today, so I might get this wrong, but...
you don't have enough parenthesis in the right spots AND COALESCE needs at least 2 arguments per instance.

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
xslt replace function rajesh_css XSLT 7 October 30th, 2008 08:39 PM
Replace Function Query rsm42 ASP.NET 1.0 and 1.1 Basics 4 August 4th, 2007 05:29 AM
replace function keyvanjan Classic ASP Basics 3 May 15th, 2006 12:57 AM
replace function Adam H-W Classic ASP Basics 3 September 20th, 2004 09:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.