New answers tagged

1

Have you tried GROUPING SETS? Something like: SELECT CS_YEAR AS YEAR, CS_MNTH AS MONTH, CS_WK AS WEEK_NO, COALESCE(COST_CARRIER, 'Total') AS COST_CARRIER, COALESCE(COST_CARRIER_CD, 'Total') AS COST_CARRIER_CD, SUM(CS_WG_CST) AS WAGE_COST, SUM(CS_PART_CST) AS MATERIAL_COST, SUM(CS_DH_CST) AS ...


3

It really depends on your main goal - if it should look 100% like your result in the question above then I am sorry the answer is no. If you want to get a result with the sum etc. yes there are ways round the union but you might not see the "Total" text. Here is one solution idea (with less data and columns as I could not extract it from your question). ...


0

In DB2, the SQL Server's recovery model simple equivalent is called circular. <p>C:\WINDOWS\system32>db2 get db cfg for sample |findstr "LOGARCHMETH1 LOGARCHMETH2" <\p> <p> First log archive method (LOGARCHMETH1) = OFF </p> <p> Second log archive method (LOGARCHMETH2) = OFF </p> If both ...


0

The minimum requirement is to have DB2 10.1.4 or DB2 10.5 installed. -createdb: Generate the CREATE DATABASE command that was used to create the source database db2look -d sample -createdb


0

I just had the same problem! In my case the problem was just the memory of the DB2 instance. In windows type: db2 get dbm cfg | findstr MEMORY In linux: db2 get dbm cfg | grep MEMORY You will get something like that: Global instance memory (4KB) (INSTANCE_MEMORY) = 500000 The solution in my case was simply set the same threshold value but ...


0

You can restore a v9.7 OFFLINE backup only into a V10 instance. Online won't work. Or you could use the following guide to upgrade DB2 from v9.7 to 10.1 Upgrading a DB2 server http://www.ibm.com/support/knowledgecenter/SSEPGG_10.1.0/com.ibm.db2.luw.qb.upgrade.doc/doc/t0007200.html?lang=en


0

Taken from DB2 UDB security. User and group authentication is managed in a facility external to DB2 UDB, such as the operating system, a domain controller, or a Kerberos security system. This is different from other database management systems (DBMSs), such as Oracle and SQL Server. +info? please click here ...


-1

the upper limit of log file size, combined with the upper limit of the number of log files (logprimary + logsecond), gives an upper limit of 1024 GB of active log space. You can increase the size of the log file size setting by issuing the command: db2 UPDATE db cfg for <databaseName> using LOGFILSIZ <new_value>


0

A schema is a collection of named objects classified logically in the database. In a database, you cannot create multiple database objects with same name. To do so, the schema provides a group environment. You can create multiple schemas in a database and you can create multiple database objects with same name, with different schema groups. A schema can ...


0

Finally I queried the answer of this question - SELECT NEXT_DAY(CAST(CAST(2016 AS CHAR(4)) || '-01-01' AS DATE)+ ((4-1)*7-1) DAYS,'FRI') FROM SYSIBM.SYSDUMMY1 Sharing here so other could also learn.


2

Based on your comment this seems to be an ISO week number, but the logic is the same for any other numbering schema: take the year and convert it to the first day of the first week of this year, then add the (weeknumber -1) * 7 to get the starting day of the week and add 4 to get Friday. I don't know about DB2 syntax, but a quick check revealed that TRUNC ...


0

There's a function for that (NEXT_DAY): NEXT_DAY(DATE(CAST((<year>*1000 + (<week>-1)*7+1) AS CHAR(7)) -1, 'FRI') Thanks dnoeth for the tip on -1!


1

I believe this is a bug with the specific version of IBM's driver I was using. I was using the ODBC driver from IBM i Access Client Solutions Linux AP v07.03.00. I replaced that driver with the ODBC driver from IBM i Access for Linux v7.1.0-1.0 and now everything works as expected.


2

FWIW, I tried investigating the differences between a newly created index in a db copy and the original index in syscat.indexes, sysibm.sysindexes and sysstat.indexes. The only difference I could spot was a slightly better density (100) for the new index compared with the old one (87). I therefore ended up recreating the index, and now the execution plan is ...


6

This simple question has caused an unusual amount of debate, and I feel compelled to quote an authoritative source. The database stores all data in tables that are related to one another. Relationships are established between tables such that data is shared and duplication is minimized. A table space is a storage structure containing tables, ...


-1

A database is a collection of schemas, a schema is a collection of tables/views/UDF/...


-1

schema = namespace within database, identical to user account database = single database


0

Not sure what version of db2 you are using, but if it's LUW you can use: select enforced from syscat.tabconst where tabschema = ? and tabname = ? and constname = ? FWIW, it is better to use the syscat views (vs sysibm), since they are more stable between versions.


1

I had the same problem. I set all foreign keys not enforced, then I loaded the tables and set the foreign keys enforced. Several fail. I do a query: SELECT TABSCHEMA, TABNAME, STATUS FROM SYSCAT.TABLES where status = 'C' For the tables, that are shown, I do a: set integrity for table immediate checked This works. Afterwards I can set all foreign keys ...



Top 50 recent answers are included