Create Database and Create Table

Post Reply
vaibhav.choksey
Posts: 17
Joined: Tue Apr 10, 2001 11:14 am

Create Database and Create Table

Post 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
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Create Database and Create Table

Post 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.
John Turnbull
Thunderstone Software
vaibhav.choksey
Posts: 17
Joined: Tue Apr 10, 2001 11:14 am

Create Database and Create Table

Post by vaibhav.choksey »

hey john!
Can u send me an example regarding create database and create table using script?
thanks
-vaibhav
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Create Database and Create Table

Post 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>
John Turnbull
Thunderstone Software
Post Reply