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 August 3rd, 2005, 08:20 PM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Case Statements

Is there some way to nest Case statements?

Update zWorkingTemp
Set zWorkingTemp.[Benefit Group] =
Case EjRegion
When 'NY' then
Case EjDivision
When '8517' then 'OAB New York NY'
End
Else [Benefit Group]
End

I want to make certain that both criteria are evaluated before updating zWorkingTemp.[Benefit Group]. So far I get nothing from this query.

 
Old September 7th, 2005, 08:46 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nested case example to show you it does work:

Select
title,
price,
royalty
,test = case royalty when 10 then 'Y'
when 12 then (case when datepart(dw,getdate()) in (1,2,3,4) then 'X' else 'Y' end)
else 'N' end
from titles
order by test






Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch Case statements ermy78 Access VBA 3 October 20th, 2006 08:58 AM
CASE Statements in T-SQL atcs2152 SQL Server 2000 3 April 28th, 2006 10:53 AM
Case Select Statements & Updating the Database jackiew General .NET 1 April 11th, 2006 11:47 AM
search string either Upper case or lower case rylemer Beginning VB 6 3 March 24th, 2004 04:23 PM
Case Statements in Access dbegg Access 2 September 17th, 2003 04:30 PM





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