I want to know whether there exists a pivot feature in IBM DB2 because I get an exception that it doesn't exists .. If it doesn't exist in DB2 , is there any other way to achieve pivot in IBM DB2 ?
I'm using IBM DB2 9.7 version.
There is no inbuilt pivot feature in db2 like SQL Server.
However you can achieve pivot using DECODE function in db2.
Check this link for further Information on how to achieve Pivot Functionality using DECODE function
Related
I need to insert into oracle database table, with one of the column type as RAW(16). I am looking for a dataframe api which can do the equivalent of oracle RAWTOHEX/HEXTORAW.
I have a application which uses Firebird (Version 2.5) database. I wanted to trigger one of the table entry to another database table which is in SQL Server 2008 R2. When I commit I am getting this following error
ErrorCode: 335544569 (ErrorMessage: Dynamic SQL Error SQL error code = -104).
Code:
CREATE TRIGGER "trig_INV"
FOR "INVA"
ACTIVE
AFTER UPDATE
POSITION 100
AS
BEGIN
IF ((updating) AND ((old.cold <> new.cold))) THEN
BEGIN
INSERT INTO 192.168.17.206/1043: [RBT].[dbo].[N_Inv]([COLA], [COLB], [COLC], [COLD], [COLD], [COLE])
SELECT FIRST 1
"COLA", "COLB", "COLC", "COLD", "COLE"
FROM "INVA"
ORDER BY COLA DESC
END
I am not sure firebird trigger allow to push records to a SQL Server database. It will be great if anyone has tried such and provide some reference. Thanks in advance.
You get that error because the syntax you're using doesn't exist in Firebird. Firebird has no support to connect to other database systems than Firebird (in theory you could write a provider that allows connecting to other databases systems, but as far as I know, none exist in reality).
If you want to synchronize to a different database system, you will either need to write a UDF or UDR (the replacement of UDFs introduced in Firebird 3) to do this for you, or a custom application that provides synchronization, or use third-party software to do this (for example, SymmetricDS).
Is it possible to find the instance name of a DB2 database by querying the catalog metadata? For instance, we can find the columns of tables using SELECT tbname, column_name FROM SYSIBM.SYSCOLUMNS. Is there an analogous query that can get the instance name?
I need this because I am running a query to get the remaining free space in the DB, across several instances. I would prefer to have the query itself tell me the name of the instance.
Running DB2 10.5 on Linux.
For DB2 LUW you can use ENV_INST_INFO. The instance name is in the column INST_NAME:
SELECT INST_NAME FROM SYSIBMADM.ENV_INST_INFO
Depending on your DB2-server version and platform, you might use MON_GET_INSTANCE table function (see IBM DB2 knowledge center for details and example). For the instance name you can use PDLOGMSGS_LAST24HOURS
I want to search a value in all column of all tables in my database. I have done it before in SQL but I don't know how I can do this in db2.
There is a pretty good (free) SQL tool SQL Workbench which has this functionality
I have installed oracle 10g express edition and I did not find the option to
create schema..
Is there a option to create schema in oracle 10g express edition
or else I have to install other oracle 10g..?
To create schema which oracle 10g
I have to install... what?
You don't need to explicitly create schema, Oracle automatically creates a schema when you create a user (see CREATE USER documentation).
If you really want, you can use CREATE SCHEMA statement and issue it through Oracle Express web interface or from SQL prompt.
The CREATE SCHEMA statement can include CREATE TABLE, CREATE VIEW, and GRANT statements. To issue a CREATE SCHEMA statement, you must have the privileges necessary to issue the included statements.
CREATE SCHEMA AUTHORIZATION oe
CREATE TABLE new_product
(color VARCHAR2(10) PRIMARY KEY, quantity NUMBER)
CREATE VIEW new_product_view
AS SELECT color, quantity FROM new_product WHERE color = 'RED'
GRANT select ON new_product_view TO hr;
As zendar said, creating a user automatically creates their schema (in Oracle these are pretty much the same concept).
When you create a Workspace in apex, it will ask you if you want to use an existing schema or create a new one - so that's another easy option you could use.