jaymukh
29th April 2002, 16:45
How can I generate Create table statements from Oracle Database in case I want copy some table in another database where Baan is not installed.

Thanks in advance.

Jay

patvdv
29th April 2002, 16:51
Jay,

You could use the IMP/EXP utilities to copy a single or more tables.

jaymukh
29th April 2002, 17:11
I want to create the tables in SQLServer database without data. I am writing Baan Exchange Export and SqlServer DTS for regular transafer of data to be used for our web serve.

Thanks

patvdv
29th April 2002, 17:38
You can use EXP with ROWS=N, that will avoid the export of data rows.

victor_cleto
29th April 2002, 18:50
You use what Patrick mentions, becuase this will get you the create statements for each table, you then have to "edit" this export to make it work properly on SQLserver (and remove extra sql statements not needed).

gundab
29th April 2002, 19:23
Though there are different ways to generate a 'Create Table' statement in Oracle, the best thing would be to use exp/imp utilities. The procedure is as follows:
1. export ORACLE_SID=xxx (unix) or set ORACLE_SID=xxx (NT/2000)

2.exp <username>/<pwd> file=xx.dat log=exp.log rows=n tables=txxxxxxxx
(Make sure you use username and password of Table owner)

3. Import the above file into an ASCII format as follows:
imp <username>/<pwd> file=xx.dat log=imp.log full=y indexfile=table.sql

The option indexfile will create an ASCII file with Create Table and Create Index statements. By default the Create Table statement will be Commented and Create Index statement is available to be executed. Edit this 'table.sql' file and remove 'REM' infront of the 'Create Table' statement and edit the parameters etc and optionally keep the Create Index statements or delete them from the file and save it.

jaymukh
29th April 2002, 20:24
I wrote a awk script to manipulate the output file generated using EXP command.
I now have the create table statement I need.

One of my told of a website which has freeware, can be used to view the create table statement and can be cut and pasted. I have not used it yet but you all can try...
This is the link....
www.toadsoft.com

makiju
30th April 2002, 10:54
Why not defining new remote database to baan and then you can create it by Baan...

gundab
30th April 2002, 17:17
Like I said there are different ways to create the table. The procedure I have given has more flexibility to change the parameter of the table and location of the table etc, and is applicable to any situation and not necessarily with Baan.