Wrox Programmer Forums
|
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 November 14th, 2006, 10:29 AM
Authorized User
 
Join Date: Jul 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Weird Concantenation

Hello and thanks for taking a moment to read this message.I have two colums from which I am taking values. One of which(a bit field), i am running a CASE statement against it to get SQL Server to return a string. The other is just a simple varchar column. My SELECT statement for the columns look like this:

SELECT Case tblDisplayProfile.Approved When 0 then 'Not Approved' when 1 then 'Approved' else 'Not looked at' END AS Approved, tblDisplayProfile.DisplayProfileDesc

These statements do return me something. Now what I want to do is combine (concantenate) the two fields. This is where I have problems. Any suggestions would be greatly appreciated.



Jason


 
Old November 14th, 2006, 10:42 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

I assume that you mean that the two "fields" you want to concatenate are the results of the CASE and the DisplayProfileDesc column...

SELECT Case tblDisplayProfile.Approved When 0 then 'Not Approved' when 1 then 'Approved' else 'Not looked at' END AS Approved, tblDisplayProfile.DisplayProfileDesc,
Case tblDisplayProfile.Approved When 0 then 'Not Approved' when 1 then 'Approved' else 'Not looked at' + ' - ' +tblDisplayProfile.DisplayProfileDesc AS Combined



--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird search panossss PHP How-To 1 February 21st, 2008 06:41 AM
weird problem! Please Help johnjohn Classic ASP Databases 5 December 21st, 2004 10:27 AM
Weird Errors kervinshim Classic ASP Databases 3 April 25th, 2004 04:08 AM





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