SQL Command Utility

The SQL Command Utility is a powerful export and global update utility that enables you to run SQL commands and scripts against Cobra tables.

SQL is an ANSI standard computer language for accessing and manipulating databases.

The SQL Command Utility provides direct access to the database. Only subject matter experts should be granted access to this menu item.

Note: Since SQL is a standard language, there are many places you can learn more about SQL. W3 Schools provides a free SQL tutorial where you will learn how to use SQL to access, define, and manipulate data. You can take this tutorial at: http://www.w3schools.com/sql/default.asp.

For example, this SQL command returns all of the data in the CAWP table:

SELECT * FROM CAWP

You can use the SQL Command Utility as a global update command. It is very important, however, that you make a backup of your project before executing any update or delete statements in the utility. Most standard SQL commands work using this utility.

By using the SQL Command Utility, you can perform all tasks related to exporting ancillary data. In addition, it allows you to restrict the exported data—for instance, exporting all rates from a specific date onward.

Once a select script has been run, you can choose to save the selection criteria to one of the following file formats:
  • Excel Workbook (*.xlsx)
  • Excel 97-2003 Workbook (*.xls)
  • CSV (Comma Delimited) (*.csv)
Note: The .txt file format is no longer supported.
Note: The .xlsx file format is supported in the SET commands for the cSaveFormat or cSaveFile parameter when running the query, either through the SQL Command Utility or a Custom Menu item.

If you do not specify a file format, Cobra defaults to .csv. If you do not specify a filename, the selected data is saved as SQLResults (for example, SQLResults.csv). In addition, if you do not specify a directory, the selected data is saved in <Documents\Deltek\Cobra>.

There are several sample scripts shipped with Cobra, for example, BDNLeg.sql. These scripts can be found in the Cobra\Samples\Scripts folder. Most of the scripts found in this folder must be modified to work with your data. For example, many scripts contain the following:

WHERE PROGRAM = 'DEMOADV'

DEMOADV must be changed to your program name in order for the script to work properly.

The following list describes a few of the scripts found in this folder:
  • DeleteActuals.sql: Use this script to delete the actual costs in the current period.
  • DropTables.sql: Use this script to drop the tables in an Oracle implementation.
  • Display Orphaned Tphase Records.sql: Use this script to select orphaned T-phase records in the T-phase table. This is useful in determining the magnitude of the data error.
Note: To see the details of a script located in the Cobra\Samples\Scripts folder, open it in a text editor like Windows Notepad.

You can also run the SQL Command Utility through the API.