Data Base Tips/ SQL Commands...

Monday, August 01, 2005

SQL Scripts

You can type each SQL Command at the SQL> prompt and end it with a semiconlon - ; This Works fine. You might however, choose to write your commands and execute them altogether, by running a script.


To run a script, you should follow these steps:

1. Using the tect editor of your choice(e.g., Notepad, TexPad, WordPad), create a file called myCommands.sql. The .sql qualifier is not required, but is highly recomended.


2. Scripts can contain commnets. the convention for writing comments is: /* Your comments here, not sql Commands */. You should comment all you scripts. Imagine you want to figure out what you did 6 months down the road!!! you will be thankful you took the time to write comments.


3. Run the script. For example: @C:\My Documents\scriptname.sql will exdcute the script called scriptname.sql located in the My Documents Directory on your C drive.


Post a Comment

<< Home