Page 1 of 1

Create Database and Create Table

Posted: Wed May 02, 2001 3:37 pm
by vaibhav.choksey
I was wondering, if I can write a script to create database and table? So that I don't need to go to SQL prompt every time and create table.
I have installed Texis on Windows2000 server.

Thanks
-Vaibhav

Create Database and Create Table

Posted: Wed May 02, 2001 3:46 pm
by John
Yes, you can create a file with SQL statements in it with SQL commands, and then run:

tsql -m -d database -i filename

which will create the database and process the SQL statements in filename, which can be the CREATE TABLE and CREATE INDEX statements you want.

Create Database and Create Table

Posted: Wed May 02, 2001 4:42 pm
by vaibhav.choksey
hey john!
Can u send me an example regarding create database and create table using script?
thanks
-vaibhav

Create Database and Create Table

Posted: Wed May 02, 2001 5:04 pm
by John
If you put:

CREATE TABLE test (x int);

in filename, and run the command:

tsql -m -d database -i filename

it will create the database and the table test. You could alternatively do it with a Vortex script, e.g.

<SCRIPT LANGUAGE=vortex>

<A NAME=main>
<createdb c:/db "System_pass" "">
<DB=c:/db>
<SQL "create table test(x int)">
</SQL>
</A>
</SCRIPT>