User Profile

Collapse

Profile Sidebar

Collapse
ricky
ricky
Last Activity: Feb 18 '14, 03:37 AM
Joined: Jul 31 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ricky
    started a topic Can DB2 stored procedure run a .sql file?
    in DB2

    Can DB2 stored procedure run a .sql file?

    I am using Db2 9.5 LUW. Is there a way in DB2 stored procedure can run a .sql file? Like the following:

    Code:
    sql file: abc.sql
    insert into tbl values ('ABC','Very Long Text here');
    
    SP: SP_TEST
    CREATE PROCEDURE SP_TEST()
       language sql
       BEGIN
       --Read and run from C:\MyPath\abc.sql
    END@
    See more | Go to post
    Last edited by Rabbit; Jan 2 '14, 04:07 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.

  • ricky
    started a topic How to convert columns to rows
    in DB2

    How to convert columns to rows

    Hi,

    I have some procedures with dynamic sql(generic procedure for different tables) to do the convert columns to rows but have performance issue. Is there a better way like a single SQL that can solve my problem, thanks!!!

    Table A(total 20 columns)
    Col1 Col2 Col3 Col4 ... Col20

    Table B(total 10 columns)
    Col1 Col2 Col3 Col4... Col10

    My procedure like this(pseudo code)...
    See more | Go to post

  • .bat file call DB2 stored procedure, without the connection string?

    I have a run.bat and a sql file. For security reason, I can't explicit the Password in MySql.sql file, any solution can help?

    1) run.bat
    db2cmd /c /w db2 -tvf C:\MySql.sql -z result.log

    2) MySql.sql
    connect to DBname user UserID using Password;
    call SP_TEST('This is Testing', ?);

    Thanks!
    See more | Go to post

  • ricky
    started a topic DB2 process concurrency/ lock question
    in DB2

    DB2 process concurrency/ lock question

    I have three SPs to test concurrency processing & row lock.

    i. SP_X6, simply do insert a record into table test_lock values (i, 'N', current time, null, null) per 5 seconds.
    Table structure:
    (
    Number int,
    Status char(1),
    Create_time timestamp,
    SP1_time timestamp,
    SP2_time timestamp
    )

    ii. SP_LOOP_X4() & SP_LOOP_X5() which simply loop and call SP_X4,...
    See more | Go to post
No activity results to display
Show More
Working...