Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38422

Is there a SQL hashmap?

Path csiph.com!news.bbs.nz!.POSTED.184-155-113-241.cpe.cableone.net!not-for-mail
From "Eric Douglas" <eric.douglas@1:261/38.remove-i5b-this>
Newsgroups comp.lang.java.programmer
Subject Is there a SQL hashmap?
Date Tue, 26 Jun 2018 09:03:18 -0500
Organization Agency News - Dunedin, New Zealand
Message-ID <5B329ADB.1161.ucljprogr@castlerockbbs.com> (permalink)
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
Injection-Info news.bbs.nz; posting-host="OzrHixpCILyhgWpD0JEChpw8GfzwXVr5j8UB2bSv2xw"; logging-data="16453"; mail-complaints-to="abuse@news.bbs.nz"
To All
X-FTN-MSGID 1:261/38.0 42c009a5
X-Comment-To All
X-FTN-Kludge CHARSET: LATIN-1
X-FTN-AREA COMP.LANG.JAVA.PROGRAMMER
X-Gateway castlerockbbs.com [Synchronet 3.17a-Linux NewsLink 1.108]
Xref csiph.com comp.lang.java.programmer:38422

Show key headers only | View raw


From: Eric Douglas <e.d.programmer@gmail.com>

I'm using JDBC with java.sql.PreparedStatement on SQL Server 2012.

I'm trying to write a translate that says "select <map value> (where
table1.field = <map key>) from table1"

Getting a bit tired of writing it as "select iif(table1.field = 'first
key','first value',iif(table1.field = 'second key','second value','default'))
from table1"

Just a better syntax to do such a thing within the SQL, or a way to pass the
values as a parameter?  Ideally I would just create a table and write the
values there and join that table, but I don't want to alter that database which
 was created by our third party application.

I was hoping to avoid the other option, modifying the code that gets the
results of the query to translate that result field, since this section of the
code is generic - used to send the results of multiple queries to a
spreadsheet.

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Is there a SQL hashmap? "Eric Douglas" <eric.douglas@1:261/38.remove-i5b-this> - 2018-06-26 09:03 -0500
  Re: Is there a SQL hashmap? "Arne Vajhøj" <arne vajhøj@1:261/38.remove-i5b-this> - 2018-06-26 12:23 -0500

csiph-web