Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Posts
    1

    Unanswered: urgent...basic DB2 queries

    Hi Guys,

    I have few basic queries on DB2 (using ver DB2 UDB7.2)

    I have to create 15-20 tables in DB2 with indexes,PrimaryKey and other constraints.
    I am using DB2 for Win NT Administrative Client, therefore i have access to Control Center,command center and commandline processor.

    Queries:
    ----------
    1) i have sql script for Table Creation and i want to know where to execute the script?
    If i try to run it in command center interactively it gives sql error?

    2) How to execute the sqlscript from Unix, i.e how to run the shell script which will execute the sql script?

    3) Need an example of a sql stored procedure which does not use any application development environment like c, java or fortran.

    4) Can u recommend some good website for DB2(unix) for beginners ...(version UDB 7.2)

    please help. It's quite urgent.

    Thanks,
    Jack.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: urgent...basic DB2 queries

    Assuming you are using Unix :

    1) Create a file with the 'CREATE TABLE' Statements

    Ex : filename : create_table.sql

    CREATE TABLE SAMPLE1(PARTNO INT,PARTDESC CHAR(50)) ;

    CREATE TABLE SAMPLE2(PARTNO INT,SUPPLIER CHAR(25)) ;

    2) Logon or 'su' to instance owner eg. db2inst1 and 'cd' to the directory where you have stored the script .

    $ db2 -tvf create_table.sql

    Here the parameter 't' refers that the default statement delimiter( has been used, 'v' represents verbose mode output and 'f' tells the command that the string following is the name of a file containing SQL Statements.

    You can use any other user to create the tables, but since you seem to be a beginner, I suggest you to use the instance owner to play with .

    There are six tutorials covering the topics for 'DB2 fundamentals' certification exam which can be downloaded at no-cost from

    http://www-105.ibm.com/developerwork...View&Count=500


    HTH

    Cheers

    Sathyaram


    Originally posted by jack_gent
    Hi Guys,

    I have few basic queries on DB2 (using ver DB2 UDB7.2)

    I have to create 15-20 tables in DB2 with indexes,PrimaryKey and other constraints.
    I am using DB2 for Win NT Administrative Client, therefore i have access to Control Center,command center and commandline processor.

    Queries:
    ----------
    1) i have sql script for Table Creation and i want to know where to execute the script?
    If i try to run it in command center interactively it gives sql error?

    2) How to execute the sqlscript from Unix, i.e how to run the shell script which will execute the sql script?

    3) Need an example of a sql stored procedure which does not use any application development environment like c, java or fortran.

    4) Can u recommend some good website for DB2(unix) for beginners ...(version UDB 7.2)

    please help. It's quite urgent.

    Thanks,
    Jack.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •