case

How to write SSIS switch/case expression?

Hi, This is a SQL Server Integration Services (SSIS) expressions question (I'm pretty new to it). I would like to write a switch/case expression in a Derived Column transform - basically the new column can have 5 different possible values, based on the value of an input column. All I got from Google is the (condition) ? (true value) ...

in sqlserver, need to select one of two columns, can a case statment do this?

My table: Users (userID, col1, col2) I want to make a generic stored procedure, but I need to return EITHER col1 or col2 in a query. Can I case statement handle this situation? SELECT userID, col1 FROM Users OR SELECT userID, col2 FROM Users ...

Generated Doctrine models respect case, but generated Yaml does not

Just getting started with Doctrine ORM for PHP (v1.1.5) and ran into something unexpected. I am generating models from the db (MySQL 4) using: Doctrine::generateModelsFromDb($pathToModels); Then generating YAML from the models using: Doctrine::generateYamlFromModels($pathToSchema . '/schema.yml', $pathToModels); In the generated m...

Bash Case menu - dynamic choices

Hi guys, I'm not sure what the policy is here on asking followup questions. So please excuse me if i'm breaking protocol. Earlier I was constructing a menu in bash ( Here ) And so far I've got it working really good. Code here. while [[ 1 ]] do cat -n "$dumpfile" read -p "Please make a selection, select q to quit: " choice ...

How can I invert the case of a String in Java?

I want to change a String so that all the uppercase characters become lowercase, and all the lower case characters become uppercase. Number characters are just ignored. so "AbCdE123" becomes "aBcDe123" I guess there must be a way to iterate through the String and flip each character, or perhaps some regular expression that could do it....

IReport Case in Variable

I write this code in one variable in the IReport : $F{wbsWbkRef.wbkStdRef.stdBlRtntp.blCode} != null ? ReportUtil.getFirstEntity($P{JPA_ENTITY_MANAGER}, "SELECT "+ "CASE WHEN std.stdBlRtntp.blCode IN ('UNIVGRANT' , 'BEHYAR','TEACHER','GRANTED','EXTGRANTED','EXTGRANTED') THEN "+ "DECODE (std.stdBlAcctp.blCode , 'UNIVGRANT' ,'داخل'...

Interbase SQL SELECT query using CASE

I'm running the following query against a .gdb-file: SELECT CASE USERS.USERID WHEN 1 THEN 'God' ELSE 'Somebody else' END FROM USERS; However, running essentially the same query against a .ib-file, I get "Error at line 1 Dynamic SQL Error, SQL error code = -104, Token unknown - line 1, char 17". It seems it doesn't recognize the part C...

Are you using "pen and paper" during programming?

There are many CASE tools, many software for diagrams, drawing, documenting. But can they replace old good paper? ...

Case ... When with strings in mysql

Hi I want to have some query like Select case column1 when column2 like '%Test%' then column 3 else 0 end FROM myTable in column2 there are varchars stored. Can someone help me with this? ...

case issue in erlang

Hi Working with erlang- case I m facing a propblem.following is the problem other langauges:- switch(A) { case "A" : case "B" : //do-somthing break; } so using erlang how to achieve the same thing..because some times it very important to put condition like this..to avoid overhead. Thanx in Advance. ...

ORACLE- CASE requires an INTO?

When I try the following: declare var_type VARCHAR2(10); begin var_type := 'B'; select case var_type when 'B' then 'Beans' when 'L' then 'Legumes' end from tableOfBeans ; end; I get an error saying ORA-06550: line 4, column 1: PLS-00428: an INTO clause is expected in this SELECT sta...

Excel VBA Select Case Loop Sub

In my excel file, I have a table setup with formulas. with Cells from Range("B2:B12"), Range ("D2:D12"), and etc every other row containing the answers to these formulas. for these cells (with the formula answers), I need to apply conditional formatting, but I have 7 conditions, so I've been using "select case" in VBA to change their i...

Runtime bugs due to case-sensitivity in (variable) names.

We recenly had a problem (http://stackoverflow.com/questions/1845817/antlr-cannot-launch-the-debugger-time-out-waiting-to-connect-to-the-remote-pars/1848755#1848755) where there was a runtime bug which could have been due to case-sensitivity in (variable) names and was OS-dependent. This was in ANTLR but I am wondering more generally whe...

JavaScript Regular Expressions - Forcing case when replacing

Does the JavaScript regex standard support forcing case when doing a search/replace? I am generally aware of the \u etc. options for forcing the case of a capture group in the replacement portion of a regular expression. I am unable to figure out how to do this in a JavaScript regex though. I do not have access to the JavaScript code ...

Why is the corresponding statement not executed even if echo empty($location) prints out 1

echo empty($location); switch($location){ case (empty($location)): expression 1; break; case ($location%10000==0): expression 2; break; case ($location%100==0): expression 3; break; default: expression 4; break; } When I echo empty($location), it prints out 1, why is expression 1 not executed? ...

C# Console case statment help

using System; using System.Collections.Generic; using System.IO; using System.Text; namespace LittleQuizworld_3 { class Program { public string QuestionText; //Actual question text. public string[] Choices; //Array of answer from which user can choose. public int Answer; //Index of correct answer with Choices. ...

SQL CASE [Column] WHEN IN ('case1', 'case2') THEN 'oops' END?

Is there a way to check a CASE when it's in an array: SELECT CASE [Option] WHEN IN (1, 3, 99) THEN 'Wrong option' ELSE 'You go!' END ...

using CASE in T-SQL in the where clause?

Im trying to use case to vary the value im checking in a where clause but I'm getting the error: incorrect syntax near the keyword 'CASE' SQL Server 2005 select * from table where ((CASE when adsl_order_id like '95037%' then select '000000'+substring(adsl_order_id,6,6) ELSE select adsl_order_id END) ...

Scala semantics of equals/hashCode for case classes with traits

I am a newcomer to Scala. In 2.7.7, the following code abstract class C case class CC() extends C trait T val c1 = CC() val c2 = new CC() with T println(c1.hashCode == c2.hashCode,c1 equals c2) prints (false,true) whereas I would have expected (false,false) What am I missing? Thanks in advance. ...

SQL query to conditionally sum based on moving date window

I'm trying to figure out some sliding window stats on my users. I have a table with a user, and columns such as created_at and verified_at. For each month, I'd like to find out how many users registered (a simple group by date_trunc of the created_at), and then of those people, how many verified within my sliding window (call it 60 day...