SQL-scripts 
Author Message
 SQL-scripts
How can i run SQL-scripts in DB2?


Can i also save like in Oracle the last commandline?

Thankx



Sun, 15 Aug 2004 19:02:33 GMT
 SQL-scripts

   Folks, please search previous postings before asking your question...
As I recall, this one is asked with painful frequency.

   From a command prompt (if you're on Windows, from a "DB2 Command
Window"), use "db2 -f xxx" to run the SQL that is in a file called
"xxx".

   If the SQL in that file spans multiple lines, delimit the statements
using a termination character (default is ";"), and run the file by


   I'm not sure what you mean by "save like in Oracle the last
commandline".  If you mean the ability to retrieve previously-issued
commands, that's a function of the command shell, not the database.
--
Larry Menard
IBM Workstation Database (DB2) Performance Team
Defender of Geese and of all things Natural

Quote:
> How can i run SQL-scripts in DB2?


> Can i also save like in Oracle the last commandline?

> Thankx



Sun, 15 Aug 2004 21:12:46 GMT
 SQL-scripts
Hi,

open a DB2 command window (Windows) and issue
 db2 -tf sciptname

t means ";" is the termination character
f stands for a filename to be specified

There are more possible options have a look at the documentation
unde COmmand Options.

The script can be written with any editor and should look like
connect to sample;
create table test (xyz char(1));
....

I hope this helps - It would be great if
you could send me the same How To for Oracle ;-)

Thanks Michael

Quote:

> How can i run SQL-scripts in DB2?


> Can i also save like in Oracle the last commandline?

> Thankx



Sun, 15 Aug 2004 21:57:15 GMT
 SQL-scripts

Quote:

> How can i run SQL-scripts in DB2?


> Can i also save like in Oracle the last commandline?

> Thankx

db2 -f "filename"

about saving I have no idea but if you are using unix you have it the
history. If you want to save it in a file, redirect last command to
the file.



Mon, 16 Aug 2004 01:37:24 GMT
 SQL-scripts
Which platform are you on? When running the CLP froM NT you get the
history natively (just use up-keys).
On Unix you can use whatever you please for a shell. Personally I "live"
in xemacs and my
CLP also runs in an emacs shell session. This way I also get emacs' full
shell support.

Cheers
Serge
--
Serge Rielau
DB2 UDB SQL Compiler Development
IBM Software Lab, Canada



Mon, 16 Aug 2004 08:02:36 GMT
 SQL-scripts
Just to add my 2 cents, you can also use the -l option to log stuff in an
history file.

PM



Mon, 16 Aug 2004 23:25:08 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. Calling sql script from a sql script

2. Is it possible to read a sql script from another sql scripts

3. How to run a SQL script from within a SQL script

4. Converting Oracle SQL scripts to Microsoft SQL Scripts?

5. SQL Script to generate SQL Scripts???

6. Calling sql script from sql script

7. How to Call a SQL Script file from another SQL Script File

8. T-SQL script call T-SQL script

9. call a sql script from a .... sql script

10. execute many sql-scripts in one script

11. Executing sql scripts within a script (?)

12. Oracle-Script -> MS-SQl-Script


 
Powered by phpBB® Forum Software