Hi,
I'm trying to achieve this
select
case
when Org_CD = '1111' or Org_CD in (select distinct New_Org_CD from #temp) then 'International'
end as 'Organisation',
count(*)
from #AnotherTempTable
group by
case
when Org_CD = '1111' or Org_CD in (select distinct New_Org_CD from #temp) then 'International'
end
I re...
I need to make a decision about a string based on the first character, and I have a method defined in this way:
(defn check-first [string]
(case (get string 0)
"+" 1
"-" 2
3
))
Currently it always returns 3 even when the string starts with those characters. What am I doing wrong? Also, is there a more elegant way to ...
My application (Ruby 1.9.2) may raise different exceptions, including net-connection breaks. I rescue Exception => e, then do case/when to handle them in defferent ways, but several errors go through my cases straight to else.
rescue Exception => e
p e.class
case e.class
when Errno::ECONNRESET
p 1
whe...
I have bash script that I use regularly in my job to automate a large job. I was making some changes today, but everything seemed fine. The script itself is about 1700 lines long. The first part of the script is all good and runs through all the user input and logic just fine. It then proceeds into the core of the script and stops wo...
I'm not as familiar with SQL Server 2008 and I haven't seen an answer to this question anywhere else. Does TSQL in SQL Server 2008 allow for multiple fields to be set in a single case statement. For instance:
case MyField
when 1 then ThisField = 'foo', ThatField = 'bar'
when 2 then ThisField = 'Mickey', ThatField = 'Mouse'
e...
Hello all.
I'm not very familiar with machine code, but I think this is a pretty simple question.
If I want to do error handling via an integer returned from a function (as opposed to the function throwing an exception), is it better practice—from a machine code standpoint—to:
Check the integer in a conditional statement for a "bad"...
Is there any way to make a case condition in a switch statement where you say if a string begins with something?
ex
Switch (mystring)
{
case("abc")://String begins with abc (abcd or abc1 or abcz or abc.. or abc will fall in this condition).
//Do Something
break;
default:
break;
}
UPDATE
Other strings can be di...
Hi,
I have the following code with a small bug in it, the case statement returns the value "other" even though the first "when" statement evaluates true and should return "boats".
I've been been looking at this for ages, must be something small.
CATEGORIES = {:boats => [1, 2, 3, 4, 5, 6],
:houses => [7, 8, 9, 10],
...
So I have case statements grouped together here, but I have a few case statements that need extra decision based on a second variable after the original case is confirmed.
This is what I have now:
Case "PRIVATE_PARTY"
If Condition = KBB_CONDITION_EXCELLENT Then
Vehicle.MarketValue = Response.PrivatePartyExcellent
ElseIf...
Hi all, I need to be able to convert all input fields in a DetailsView (Insert) to uppercase. How do I do this? My SQL query and the whole insert statement takes place in ASP.NET, and not in code behind so I'm not sure if I can dynamically do this in ASP.
I've used Text-Transform in CSS to make them look uppercase for the user, but it s...
The last two parameters are PHP WHERE and ORDER clauses, they (probably) don't matter here.
fornecedores.nome_emp AS nome_fornecedor, exchange_rates1.rate AS rateEUR_USD,
exchange_rates2.rate AS rateEUR_AOA,
CASE produtos.moeda
WHEN 'AOA' THEN produtos.preco_custo / exchange_rates2.rate
WHEN 'EUR' THEN produtos.preco_custo
WHEN 'USD'...
how do i incorporate a nested if statement in a select clause of a sql query?
I know to use case when condition then X else y end but how do you do a nested one in the same fashion for each record in a record set.
if x.boy is not null then
x.boy
else if x.girl is not null
then x.girl
else if x.dog is not null
then x.dog
e...
Is there any tools to assist in diagramming a large C library? I am working on a project to port an existing C library to C++. The C library is largely undocumented with no diagrams. I would like to use a CASE tool to help me understand how the various files interact. There is extern variables in most of the files.
If possible I would p...
I have following query
Select
a,b,c,
case totalcount
when 0 then 0
else abcd/totalcount
end AS 'd',
case totalcount
when 0 then 0
else defg/totalcount
end AS 'e'
From
Table1
In this query, I have same case statement in select query...C...
Running on Adaptive Server Enterprise/15.0.3/EBF 17157 ESD#3/P/x86_64/Enterprise Linux/ase1503/2726/64-bit/FBO/
The below code should never enter the substring case, however I am presented with a Sybase Error 536.
Is this a form of optimization where it evaluates all paths regardless of the actual value??
We can work around this but w...
Hello Experts,
I have the following code in .net.
foreach (string key in EntityNumbers.Keys)
{
if (EntityNumbers[key] != null)
{
e = new WebServices.Entity();
e.HierarchyLevel = key;
e.Number = EntityNumbers[key];
...
Hello All,
Question 1:
I am learning SQL Server and Oracle joins (inner joins, outer joins...)
and case statements syntax. Though I can google for the info, but would
like to ask for some sites, links, and materials that fully explain the
joins and case statments. Once again, thanks.
Thanks gentlemen.
Question 2:
I am running a sim...
Well basically what the title says, when making an AJAX request with JavaScript. Does the method, i.e. GET / POST, need to be upper case? Thanks in advance.
Edit: Even a yes or no will suffice.
...