db2

Column alias querying IBM DB2 using Oracle SQL developer

谁说我不能喝 提交于 2020-01-07 05:04:08
问题 I'm connected to an IBM DB2 database using Oracle SQL Developer and I'm querying several tables in order to perform an automated extraction of data. The issue here is that I can't set aliases for my results. I tried a lot of variants like adding quotes ("") ([]) ('') and it's not working. I saw several tutorials and everyone uses "AS" only, but for me it's not working. Any recommendations? Thanks! Image as example here : https://i.stack.imgur.com/5NrED.png My code is: SELECT "A"."TC_SHIPMENT

SQL using COUNT and CASE for related table - error is returned

故事扮演 提交于 2020-01-07 04:55:08
问题 I have table T1: ID GROUPINFO STATUS 1 GROUP1 NEW 2 GROUP1 INPROG 3 GROUP2 INPROG I have table T2 also T2ID T1ID STATUS 1 1 NEW 2 2 NEW 3 2 VENDOR 4 3 NEW 5 3 VENDOR I want to count by group how many of those records have the status NEW, and how many of those records were in the status VENDOR (information from T2 table) This SQL works SELECT T1.GROUPINFO, count (case when T1.status='NEW' then 1 end) as New FROM T1 GROUP BY T1.GROUPINFO However when I try to add how many of those records were

Finding max of nullable date between two columns in db2

守給你的承諾、 提交于 2020-01-07 03:46:51
问题 I have a table in Db2 called myTable . It has several columns: a | b | date1 | date2 --------------------------------------------- 1 abc <null> 2014-09-02 2 aax 2015-12-30 2016-09-02 2 bax 2015-10-20 <null> 2 ayx 2014-12-10 2016-02-12 As seen from values above, date1 and date2 can have null values as well. How can I get the max of both date1 and date2 together ? i.e. the output of the query should be 2016-09-02 as that is the max date of all the dates present in date1 and date2 . I am using

现时代DBA存在的价值

被刻印的时光 ゝ 提交于 2020-01-07 00:39:28
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 简介: 未来DBA的存在数量是否会越来越少,或者严重一点,DBA这个职业直接消 原创: 走起君 SQLServer走起 最近走起君在思考一个问题,未来DBA的存在数量是否会越来越少,或者严重一点,DBA这个职业直接消失,现在是2019年,很快踏入2020年,数据库行业还在飞速发展 下面是走起君思考后,做出的一些看法: 既然DBA是管理数据库的人,那么这个问题是否可以理解为,现在市面上的数据库是否有被DBA管理的必要 下面走起君大概做了四个数据库/数据管理的分类 第一个商业数据库 现在商业数据库基本上用的最多的就是:Oracle、SQL Server、DB2 这三家数据库厂商都在它们的最新版本数据库产品里分别加入了:区块链、nosql、图数据库、AI人工智能、机器学习、数据库自治等功能 从中可以看出几个趋势 第一个趋势是,对于传统的oltp数据库功能,这些商业数据库都已经趋向于使用人工智能/机器学习等技术去自动优化数据库,尽量减少人工的介入 第二个趋势是,商业数据库不断向外延伸,增加了nosql、图数据库、内存表等功能,变得越来越庞大,以满足企业越来越多的需求,通吃nosql数据库和图数据库的市场 第三个趋势是,跟大数据相关技术打通 而走起君对于商业数据库DBA的看法是,未来商业数据库DBA会越来越少

store in char column getting from decimal column in db2

…衆ロ難τιáo~ 提交于 2020-01-06 23:43:05
问题 create table test1 (no decimal(4,2) ,name char(10)) create table test2 (no char(1) ,name char(10)) insert into test1 values(1,'aa') insert into test1 values(2,'ab') insert into test1 values(3,'ac') insert into test1 values(4,'ad') insert into test1 values(null,'ad') insert into test2 (no,name) (select cast(no as char(1)),name from test1) not working. any clues. Thanks. 回答1: Are you intentionally using CHAR rather than VARCHAR? VARCHAR won't pad your text with spaces. When I run the insert, I

Drop DB2 table if exists

对着背影说爱祢 提交于 2020-01-06 19:31:46
问题 In my script I have to do a lot of selects to a joined table, so instead I decided to put this join into a temporal table. First I thought: 1. Create table 2. Put the data from the join into a table 3. Drop the table But then I thought, what if the script fails before I dropped the table? So I decided to go with: 1. Drop the table 2. Create the table 3. Put the data from the join into a table I don't really mind if the table is left there until the next time I run the script, so the second

Using @ on Variable Names

会有一股神秘感。 提交于 2020-01-06 19:06:53
问题 Googling I've found this DB2 Function declaration: CREATE FUNCTION QGPL.SPLIT ( @Data VARCHAR(32000), @Delimiter VARCHAR(5) ) Whats means @ symbol before the Variable Name? Regards, Pedro 回答1: The @ character is simply the first character of the SQL identifier [variable name] naming the parameter defined for the arguments of the User Defined Function (UDF); slightly reformatted [because at first glance I thought that revision might make the at-symbols appear more conspicuously to be part of

Using @ on Variable Names

∥☆過路亽.° 提交于 2020-01-06 19:06:07
问题 Googling I've found this DB2 Function declaration: CREATE FUNCTION QGPL.SPLIT ( @Data VARCHAR(32000), @Delimiter VARCHAR(5) ) Whats means @ symbol before the Variable Name? Regards, Pedro 回答1: The @ character is simply the first character of the SQL identifier [variable name] naming the parameter defined for the arguments of the User Defined Function (UDF); slightly reformatted [because at first glance I thought that revision might make the at-symbols appear more conspicuously to be part of

Using @ on Variable Names

风格不统一 提交于 2020-01-06 19:06:01
问题 Googling I've found this DB2 Function declaration: CREATE FUNCTION QGPL.SPLIT ( @Data VARCHAR(32000), @Delimiter VARCHAR(5) ) Whats means @ symbol before the Variable Name? Regards, Pedro 回答1: The @ character is simply the first character of the SQL identifier [variable name] naming the parameter defined for the arguments of the User Defined Function (UDF); slightly reformatted [because at first glance I thought that revision might make the at-symbols appear more conspicuously to be part of

IBM Rational System Architect using DB2

本秂侑毒 提交于 2020-01-06 14:53:10
问题 Currently I am looking to setting up IBM Rational System Architect 11.4.3.0, however I need to get a database setup first to connect with it. I see from the system requirements it only supports SQL Server/Oracle. Due to various restrictions, I am unable to use this currently and the only available option is DB2. Is it possible to hook System Architect to DB2, and if so, how? I already know that there is a way to do this, however cannot seem to find out, as another team in a separate