db2

Migrating .NET/MySQL app. to DB2

I want to migrate my existing desktop Windows .NET 3.5 app. that uses MySQL as backend to DB2 Express C. I downloaded IBM Migration Toolkit to migrate the database. I have further queries: How accurate is IBM Migration Toolkit? Are there any issues? For the application, just changing the connection string will do or something else? ...

DB2- fetching records having products in more than one store

I have a table having records as below store num product no. 0001 11 0002 11 0003 11 0001 12 0002 12 0001 13 I want to fetch records having products in more than one store. The result should be...

DB2 how to get the last insert id from a table.

Hi, i want to get the value of the last id insert in a table. How i can do this? ...

Dynamically create Blob in DB2 Java stored procedure

I would like to return some data as a Blob from a DB2 stored procedure written in Java. This is the code to generate the procedure on the DB2 server: CREATE PROCEDURE CLUB.P_CLUB_GET_BACKUP ( IN CLUBID INTEGER, IN BNR INTEGER, OUT BACKUP BLOB(50000000) ...

How to call a DB2 stored procedure from C#?

I use DB2 9.7 for Linux. The stored procedure is implemented in PL/SQL (Oracle's programming language), so, the record set is an output parameter (SYS_REFCURSOR). CREATE OR REPLACE PROCEDURE TEST_CURSOR ( CV_1 OUT SYS_REFCURSOR ) IS BEGIN OPEN CV_1 FOR SELECT 1 COLUMN FROM DUAL; END TEST_CURSOR; I don't know how to dec...

DB2 SELECT using alpha wildcard and the length of 4 characters

I need to do a SELECT for a product_id where the length the product_id is 4 characters long and the last character can be any letter. I know the wildcard for selecting any letters but I don't know how to denote that it has to be the last character and that the product_ids I'm looking for must be 4 characters long. Does that make sense?...

Can anyone convert this 60-bit value to geographic coordinates?!

I have a (DB2) database table containing location information, one column of which is a CHARACTER(16) and contains a single hexadecimal number. I have a program that displays these as points on a map, but no access to its source. Changing the numbers moves the points on the map — I just don't know the algorithm. Some examples (edited ...

Which implementations of SQL have PSM like functionality?

Although Oracle is one of the earliest to create stored procedures (PL/SQL) then Informix with (SPL) which RDBMS products besides DB2 have implemented SQL/PSM or a subset of it after 1998?.. Which RDBMS' can support procs like in the following example?: CREATE OR REPLACE FUNCTION foo1(a integer) RETURNS void AS $$ CASE a WHEN 1, ...

Is "LIKE ?" More efficient than LIKE '%'||?||'%'

Recently one of my colleagues made a comment that I should not use LIKE '%'||?||'%' rather use LIKE ? in the SQL and then replace the LIKE ? marker with LIKE '%'||?||'%' before I execute the SQL. He made the point that with a single parameter marker DB2 database will cache the statement always and thus cut down on the SQL ...

SQL correlated subquery in a case clause

Hello all, is it possible to write a subquery within a case clause for the when statement ie. SELECT colA, colB, CASE WHEN (SELECT colA FROM tab2 WHERE tab2.colA = tab1.colA) THEN '1' CASE WHEN (SELECT colA FROM tab3 WHERE tab3.colA = tab3.colA) THEN '2' ELSE '0' END AS colC, ... FROM tab1 Extended question: Is ...

Want to enter negative values in input parameter in Db2 stored procedure

Want to enter negative values in input parameter in Db2 stored procedure, but it is not accepting negative values.. Please help.. ...

how to find fifference between 2 dates in DB2

In my database i have a TIMESTAMP field.Now I want to find the difference between the value stored in this field and the current TIMESTAMP .I want the result in days. How can i get it? Note:I am using DB2 database ...

DB2 9.5 CREATE DATABASE fails with Error SQL0901N, SQLSTATE 58004

Installed DB2 on Windows Vista with Admin priviledges. Now i cannot create any new databases.. it always fails with the following error: db2 CREATE DATABASE N3000 AUTOMATIC STORAGE YES ON 'D:\DB2' DBPATH ON 'D:\DB2' SQL0901N Die SQL-Anweisung schlug aufgrund eines nicht schwer wiegenden (nicht kritischen) Systemfehlers fehl. Nachfolg...

DB2 Connect - Unicode Support from VB Application

I am trying to insert '€' char in Db2 Database. My Db2 database is in zOS. (v.8.0) and my Db2 client version is 9.1 FP5. I am trying this using ODBC Connection via ADODB in Visual Basic or C# code. But junk char is getting inserted. '€' symbol is not inserting. Is there any option to set the CodePage 1252 at connection level...

DB2 error on TSQL using SELECT AS alias and an inner join

I am writing a T-SQL program over a DB2 database on a LINUX box (DB2/LINUXX8664) using a linked server. I think the DB2 is Version 9.5.3 but not certain. I am receiving an error that I feel is likely a DB2 issue as the syntax checks out okay in T-SQL. This is the code: IF(SELECT(OBJECT_ID('TEMPDB..#TempFile))) IS NOT NULL DROP TABLE #Te...

problem with SQL query in DB2

How can i write a query in DB2 for following thing: The difference between current timestamp and a timestamp field in dB should be >=4 hours AND <= 24 hours ...

finding time differance in DB2

How can i write a query in DB2 for following thing: The difference between current timestamp and a timestamp field in dB should be >=4 hours AND <= 24 hours Some one suggested this but its not working. select * from tableName where date <= DATEADD([hour], -4, CURRENT_TIME) and date date >= DATEADD...

Executing DB2 scripts in Aqua Data Studio

Hi all, I have a DB2 script which I know works because I ran it by selecting each statement and running it. (has only a couple of statements). Now the issue arrises when i select the whole query and then Execute it, I get some wierd errors. but if I select the whole query and do "Execute Current" it runs fine without any errors. Can s...

Problems with Executing a DB2 External Stored Procedure

I am trying to call an external stored procedure (calls an RPG program). I keep getting the following error: "Exception Details: IBM.Data.DB2.iSeries.iDB2SQLErrorException: SQL0104 Token @SSN was not valid. Valid tokens: :." Here is my code: using (iDB2Connection conn = new iDB2Connection(_CONNSTRING)) { conn.Open(); stri...

How to get rid of label used but not defined

I'm trying to print the rows of a table in embedded sql. I have this code where publication is the table and pubid is the attribute. I tried this: EXEC SQL DECLARE C1 CURSOR FOR SELECT pubid FROM publication; EXEC SQL OPEN C1; EXEC SQL WHENEVER NOT FOUND GOTO close_c1; for(;;) { EXEC SQL FETCH C1 INTO :pubid; ...