dcsimg

How to run queries from a command prompt

Products

Webtrends Analytics 9.x
Webtrends Analytics 8.7d
Webtrends Analytics 8.5x

Cause

The following steps outline how to run queries against the Webtrends system database from a command prompt.

Resolution

1. Open a command prompt window.

2a. For installations of Webtrends which use MS SQL Server Express 2005, type the following command and then hit Enter:

sqlcmd -W -s , -S <server name>

…where <server name> is the name of the server hosting the SQL database.

2b. For installations of Webtrends which use MS SQL Server Express 2008, type the following command and then hit Enter:

sqlcmd -W -s , -S <server name>\

…where <server name> is the name of the server hosting the SQL database and is the name of the database instance. The default instance is “WTSYSTEMDB”.

3. At the prompt (1>), enter one of the following to specify the part of the database used, then hit Enter:

use wtMaster
use wt_sched

4. Type in the following and hit Enter:

GO

“Changed database context to ‘wtMaster/wt_sched'” displays.

5. Type in the queries and hit Enter. Multiple queries can be entered on separate lines. Type GO to execute a query or queries.

Example:

1> select * from wtmaster.dbo.wt_globalsettings where SettingID=’36’
2> select WRC_ProfileID from wtmaster.dbo.wt_profile where ProfileID=’1′
3> GO

More Information

Named Pipes must be enabled in order to run queries using SQL Server 2008 Express. These may be disabled by default but can be enabled in the SQL Server Configuration Manager, found under the SQL Server entry in the Start Menu.