Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't create a table in db2

Status
Not open for further replies.

adev111

Programmer
Jul 8, 2004
44
CA
hi there all,
i am a novice programmer in db2/sql and had a problem creating tables. i run this query

create table employee(employee# integer not null, branch# integer references branch(branch#),Name varchar(25),status varchar(15),hours integer(2),sin# integer(9),street varchar(25),city varchar(15),province varchar(15),postal_code varchar(6) UNIQUE(employee

and am unable to type anything after that, i asked a couple of ppl and was suggested that db2 doesn't allow u to have more than 250 characters on the command line command and was hence asked to make a shell file as it works if u execute it. could someone please tell me how could i do this? i already searched on this forum for a similar topic but in vain!

thank you very much

adev111
 
Create a text file (CrTbl.txt) with something like this in it:

update command options using c off;
CREATE TABLE NVUSER.RF_ECIW_6_04_delete
(
SUBJECT_ID CHARACTER(11),
FIRST_NAME CHARACTER(15),
etc, etc )
;


Connect to your database using "DB2 Connect to ..."
and then issue

db2 -tvf CrTbl.txt > Create.out

This works on UNIX so hopefully that's what you're using.
 
Hi PruSQLer,

Thank you for your help, it was very close. I did something like this...
in the shellfile.sh i have
. db2init //i believe thats a command to initialise db2 on our server
db2 "command here"

n it works

adev111
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top