iseries-navigator

SQL - Merge two tables with one common field

…衆ロ難τιáo~ 提交于 2019-12-12 06:45:00
问题 I've searched and searched but can't quite find what I'm looking for. I'm not totally inept when it comes to SQL but this is beyond me. So I have two table with one common field. Table - LName Feild Name Table - Descripion Field Name Field Add Field Job Now, table LName has just the one field and it is populated. Table Description has data in all fields except the 'Name' field. I need to put the data from Field 'Name' in table LName into Field 'Name' in table Description. Either that or merge

Using dynamic table name in db2

依然范特西╮ 提交于 2019-12-12 03:26:22
问题 Currently in my project development need of generating the record count based on certain criteria where the table names are stored in separate table.For instance say xx table stores the table name under the column name is tableInfo. I've written the stored procedure in such a way that DECLARE FGCURSOR CURSOR FOR SELECT tableInfo FROM xx WHERE col1='PO'; OPEN FGCURSOR; FETCH FROM FGCURSOR INTO FILEGROUPMEM; WHILE SQLCODE <> 100 DO SET COUNTVal = 'SELECT COUNT(*) FROM ' || FILEGROUPMEM || '

db2_fetch_assoc() fails midway through iterating over result set

梦想的初衷 提交于 2019-12-11 03:22:21
问题 I'm running on IBM i (an AS/400) V7R2, PHP v5.6.5, Zend Server v8.0.2. I have a query which takes less than a second to execute from iNavigator. When I run the same query from a PHP script and then loop through it using: $numRows = 0; while ($row = db2_fetch_assoc($stmt)) { //Do stuff $numRows++; } echo $numRows++; $numRows ends up only being a fraction of the expected result set and I get this error in the Zend logs: PHP Warning: db2_fetch_assoc(): Fetch Failure in /path/to/script.php on

DB2 - How to run an ad hoc select query with a parameter in IBM System i Access for Windows GUI Tool

自作多情 提交于 2019-12-07 16:54:13
问题 I would like to run some ad hoc select statements in the IBM System I Navigator tool for DB2 using a variable that I declare. For example, in the SQL Server world I would easily do this in the SQL Server Management Studio query window like so: DECLARE @VariableName varchar(50); SET @VariableName = 'blah blah'; select * from TableName where Column = @VariableName; How can I do something similar in the IBM System I Navigator tool? 回答1: I ran across this post while searching for the same

DB2 - How to run an ad hoc select query with a parameter in IBM System i Access for Windows GUI Tool

我怕爱的太早我们不能终老 提交于 2019-12-05 22:45:56
I would like to run some ad hoc select statements in the IBM System I Navigator tool for DB2 using a variable that I declare. For example, in the SQL Server world I would easily do this in the SQL Server Management Studio query window like so: DECLARE @VariableName varchar(50); SET @VariableName = 'blah blah'; select * from TableName where Column = @VariableName; How can I do something similar in the IBM System I Navigator tool? Brian I ran across this post while searching for the same question. My coworker provided the answer. It is indeed possible to declare variables in an ad hoc SQL

Concatenate Multiple Row Values into 1 Row, with SQL for iSeries

若如初见. 提交于 2019-12-01 11:00:31
First, I need to thank Kent Milligan and his article at http://www.mcpressonline.com/sql/techtip-combining-multiple-row-values-into-a-single-row-with-sql-in-db2-for-i.html for getting me as far in this problem as I have. But now I need to expand on what he has done here. To avoid you having to go to his article, the problem he addressed was concatenating string data from multiple rows into a single row in the resulting table. For example: Table Cars: Make Model Ford Fusion Chevy Tahoe Honda Odyssey Ford Taurus Ford Focus Chevy Malibu Results: Make Model Chevy Malibu, Tahoe Ford Focus, Taurus,

Concatenate Multiple Row Values into 1 Row, with SQL for iSeries

廉价感情. 提交于 2019-12-01 08:57:14
问题 First, I need to thank Kent Milligan and his article at http://www.mcpressonline.com/sql/techtip-combining-multiple-row-values-into-a-single-row-with-sql-in-db2-for-i.html for getting me as far in this problem as I have. But now I need to expand on what he has done here. To avoid you having to go to his article, the problem he addressed was concatenating string data from multiple rows into a single row in the resulting table. For example: Table Cars: Make Model Ford Fusion Chevy Tahoe Honda