Click here to Skip to main content
       

Database

 
QuestionEnd Case in a Variable Pinmemberberba30-Jan-13 9:47 
AnswerRe: End Case in a Variable PinmemberMycroft Holmes30-Jan-13 12:46 
GeneralRe: End Case in a Variable Pinmemberberba30-Jan-13 19:02 
GeneralRe: End Case in a Variable PinmemberMycroft Holmes30-Jan-13 21:57 
You are combining a select query and an assignment query, not allowed!
 
You need to nest your case statements as you need to test the case for each record, variable assignment is a once only operation (using a cursor spit would allow you to do the record by record processing).
 
This example test the value of flag but note that it must know what to expect in the nested case, your ... cannot be a random date, it must be a testable value!
 
SELECT Records, 
	CASE Flag WHEN 'FX' THEN CASE Records WHEN 0 THEN 'Failed' ELSE 'Ok' END
		WHEN 'MM' THEN CASE Records WHEN 0 THEN 'Failed' ELSE 'Ok' END 
		WHEN 'TZ' THEN CASE Records WHEN 0 THEN 'Failed' ELSE 'Ok' END END 
FROM ProcessLog PL
Never underestimate the power of human stupidity
RAH

QuestionWhat happens with auto-incremented value on rollback? Pinmemberpiticcotoc30-Jan-13 0:27 
AnswerRe: What happens with auto-incremented value on rollback? PinmemberJörgen Andersson30-Jan-13 2:04 
GeneralRe: What happens with auto-incremented value on rollback? Pinmemberpiticcotoc30-Jan-13 4:02 
GeneralRe: What happens with auto-incremented value on rollback? Pinmembermark merrens30-Jan-13 6:33 
GeneralRe: What happens with auto-incremented value on rollback? Pinmemberpiticcotoc30-Jan-13 6:43 
GeneralRe: What happens with auto-incremented value on rollback? PinmemberSimon_Whale30-Jan-13 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 26 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid