Está en la página 1de 5

Manage SQL Server Scripts

This product allows you to store files that can be run repetitively in one Directory and files that can ONLY be run ONCE in a different directory. You log into the SQL Server and run the files.

1. Initializing: SQL script files can be run in various scenarios. a) Scripts can be run at will over and over again. b) Scripts that can only be run once or they will corrupt the system. c) Scripts need to be run in a specific order. d) Scripts can contain views which are stored in the same folder as section a) above. These scripts have view as the left most four letters of the name. Scripts in sections a) and b) above should reside in different paths. Click the [Repetitive Scripts] button to fill in the Repetitive Scripts

Click the [One Time Scripts] button to fill in the Run Once Scripts

Click the [View] button to view scripts. (This is a toggle button for Views and Repetitive scripts).

If you do not have view as the left most four letters of the script name, you can ignore the Views button or bring up the form in Design mode, right click the Views button and select [Build Event]. Next, go into the code and change it to meet your requirements. 2. Filling in the Paths: The first path is the path of where the scripts that can be run repetitively reside.

The second path is the path of where the scripts that can be run only once reside.

The third path is the path of where to create the log file containing the results of the processing. The fourth path is the path of the TMViewer program to view the log file. This program which comes with the system, should be installed into this folder.

Double clicking any of the above four paths will bring up a browsing window to browse for the appropriate folder containing the script files. 3. Filling in the Servers: To add and remove servers, click the [Update Servers] button. Add the appropriate information if it exists. The ODBCDSN field is for reference so you can keep track of it, if necessary. . You can add, modify or delete server information.

Once the servers have been entered, click the [Servers] button to update the main form.

4. There are two ways to log onto SQL Server. Windows Authentication: Use Windows logon

SQL Authentication:

Use SQL Logon

When you click SQL Authentication, the Username and Password fields will appear. Fill in the appropriate logon User Name and Password information.

5. Click the [Run] button to process the scripts. 6. Click the [Audits] button to see an Audit trail of what was processed. .

The Did Script Run field will have a check mark if the script ran. This does NOT mean that the script was successful. You need to see the Results for this information. NOTE: If you try to run a One Time Only script and it already exists, it will NOT run and will NOT be included in the SQLreslts.txt file but will be included in the Audit table marked as not being run 7. You can clear the Audits by clicking the [Clear Audits] button.

8. If there is a Server Issue, click the [Server Errors] button.

9. To see the results of the processing, click the [Results] button if you have TMViewer installed. This program is used to view the text file containing the results. 10. If it is not installed, you can view the file SQLReslts.txt in the folder that contains the log files by double clicking the file. You can view the other log files the same way. 3

11. To use the TMViewer program, click the [Results] button. The following screen will appear.

Browse for the SQLReslts.txt file and click the [Open] button. After viewing the results, click the red [X] at the upper right corner of the main large screen to close the screen and return to the program. . Set the Quick path field to move directly to the path containing the SQLReslts.txt file when TMViewer opens. 12. Save the current configuration by clicking the [Save] button. 13. Restore the saved configuration by clicking the [Restore] button. 14. Click the [Views] button at the bottom of the screen to place a check mark on ALL views. 15. Click the [Repeat] button to place a check mark on ALL repetitive scripts. 16. Click the [One Time] button to place a check mark on ALL one time only scripts. 17. Click the [All Scripts] button to place a check mark on ALL scripts.

18. ALL scripts have an [Order] field that determine the order that scripts should be run.

The lower order numbers run first followed by the next lower, etc. If all scripts have the same number, the scripts run in the order they appear. The order values do NOT have to be consecutive. 19. The [Clear] button clears ALL check marks from ALL scripts. 20. The [Exit] button closes the program. 21. NOTE: When creating a Log file, if Reslts.txt already exists in the folder, it will be renamed using the following format: SQLResults-mm-dd-yyyy-hh-mm-ss-AMPM.Log mm: dd: yyyy: hh: mm: ss: AMPM: EX. You can view these files by double clicking them and open them using any word processor. Month Day Year Hour Minute Second AM/PM

También podría gustarte