Questions tagged [select-case]

164 questions
5
votes
1 answer

Is there a VB .NET equivalent to C Fall Through switch?

This is not a duplicate of this question : VB.NET Stacking Select Case Statements together like in Switch C#/Java. The answer provided here does not answer my question. The answer there is stating that there is an automatic break in VB .Net, which…
Martin Verjans
  • 4,675
  • 1
  • 21
  • 48
5
votes
4 answers

How to best convert VB6 "Select Case 1067 To 2938..." to C#?

I'm converting some VB6 logic to C# and have encountered the following SELECT/CASE statement. Select Case ZipCode Case 1067 To 19417, 35075 To 35085, 48455 To 48465, 55583 To 55596, 67480 To 67551, 75392, 85126, _ 93047 To 93059, 21217 To 21739,…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
5
votes
2 answers

Oracle SQL query with CASE WHEN EXISTS subquery optimization

I'm using the following query to create a view in Oracle 11g (11.2.0.3.0). CREATE OR REPLACE FORCE VIEW V_DOCUMENTS_LIST ( ID_DOC, ATTACHMENTS_COUNT, TOTAL_DIMENSION, INSERT_DATE, ID_STATE, STATE, ID_INSTITUTE, INSTITUTE, …
Cheshire Cat
  • 1,941
  • 6
  • 36
  • 69
5
votes
1 answer

Make a Dynamic select case (vb)

I would like to have one of my cases be a dynamic string because in my table these values changed partially except for the beginning code "2061" so how do I make my code do something similar to when I'm looking up in my query "... like '2061%' here…
4
votes
3 answers

Select Case Fall through with Not Condition in VB.NET

How to Add Not condition in the below select case. Is <> works for single value, and 'To' works for a Range but the value are specific values there are not series of numbers. Is it possible to use select case in this scenario, or do i have to switch…
kurozakura
  • 2,339
  • 8
  • 28
  • 41
4
votes
3 answers

Nested Select Case for multiple conditions

Situation: I have a code that goes through some data in a worksheet and given what is in a certain cell it pastes something on another column (same row). Ex: If my A5 is "Bond", it concatenates the contents of A5 and B5 and pastes it to J5. Obs1:…
DGMS89
  • 1,507
  • 6
  • 29
  • 60
4
votes
1 answer

INSERT INTO SELECT CASE

I have two tables, Variables and Processes. I want to implement a INSERT INTO SELECT CASE, but I've never done this before. Data goes from Variables to Processes always. But I don't know what columns. For example : Variables table has the columns…
hermann
  • 6,237
  • 11
  • 46
  • 66
3
votes
1 answer

How to create a function which return a boolean depending on a select statement result

I have a table(Id, FK, Date1, Date2) and I need to create a function that will return a boolean value. Generally I want to select records with matching the given FK and check some additional statements. I want to return true if the select statement…
Jakub Licznerski
  • 1,008
  • 1
  • 17
  • 33
3
votes
2 answers

MySql how to get `END AS` of `CASE` statement with checking another condition by `IF` or another `CASE`

I have the following query what i want to do is controlling the END AS of a SELECT CASE with checking another condition. set @lang = 'pr'; select COUNT(t1.id) as total, COUNT(t1.id) as 'Total', CASE t2.`precence` WHEN '0' THEN…
jones
  • 1,423
  • 3
  • 35
  • 76
3
votes
2 answers

Passing parameter as parameter in Fortran-90?

Suppose I have a subroutine: subroutine foo(x, Nx) implicit none integer, intent(IN) :: x integer, intent(IN) :: Nx select case(x) case (1) write(*,*) "Minimum value" case (Nx) write(*,*)…
jvriesem
  • 1,859
  • 3
  • 18
  • 40
3
votes
2 answers

Multiple select case in a select query

I'm beginning in postgres and I have an issue regarding multiple select case in a select query. bd_david=> select * from edt_sem; code_module | groupe | week | day | hour | room -------------+----------+------+-----+--------+------- M3106 …
2
votes
3 answers

SELECT CASE/JOIN when no rows

Sorry this one is a bit of a headache. I'll start with the example: Tables: TownCountry Record | Town | CountryCode -------+--------+------------- 1 | London | A1 2 | Cardiff| A2 3 | Hull | A1 4 | Luton | A1 ReFData Type …
Paul
  • 67
  • 2
  • 10
2
votes
2 answers

Nested query that requires the first result to be returned

I have 2 tables as such Table ErrorCodes: type_code desc 01 Error101 02 Error99 03 Error120 Table ErrorXML: row_index typeCode 1 87 2 02 3 01 The output should be the…
keanu
  • 123
  • 9
2
votes
3 answers

Unexpected result in SELECT CASE WHEN NULL

Schema and data I have two tables with the following schema and data: #table1: create table #table1( PK int IDENTITY(1,1) NOT NULL, [TEXT] nvarchar(50) NOT NULL ); PK TEXT 1 a 2 b 3 c 4 d 5 e #table2: create table…
Bjørn-Roger Kringsjå
  • 9,849
  • 6
  • 36
  • 64
2
votes
2 answers

Select Case Loop

I modeled a Select Case loop based on another question I found on here(Link: Excel VBA Select Case Loop Sub). The changes I had to do to make it applicable were pretty minimal, and I don't see where I went wrong. Here's my code: Private Function…
Swolerosis
  • 93
  • 3
  • 13
1
2
3
10 11