OSQL Command Syntax for Running a SQL Script



 

New Boundary Technical Support occasionally provides SQL scripts for modifying the Prism Channel database directly. An example of such a script is the one used to add the Dell Battery Recall Report to the Console.

 

Customers using full SQL Server can use the Query Analyzer tool for this operation. Customers using MSDE installed by Prism may not have a graphical tool and will have to use OSQL commands in a DOS window. This article explains the correct syntax for the OSQL command. 

 

Notes:

·         The OSQL command must be run on the SQL Server, which may or may not be the same box as the Prism server. Open a command window (DOS window) to run the command.

·         Save the SQL script that you received from NBT Technical Support locally on the SQL server before beginning.

·         Make note of the Channel database name before beginning. You can get this from the Prism Server’s registry: Hkey_Local_Machine\Software\Lanovation\Prism Deploy\Server Channels\<your Channel’s GUID>, value=Channel Database Name.

·         Make note of the SQL server name and instance before beginning. You can get this from the Prism Server’s registry: Hkey_Local_Machine\Software\Lanovation\Prism Deploy\Server Channels\<your Channel’s GUID>, value= Database Server.

 

There are two authentication methods for using OSQL to modify the database: Windows (trusted) authentication and SQL authentication. If you want to use Windows authentication, you must be logged into the SQL server with an account that has rights to modify the SQL database.

 

If you want to use SQL authentication, you must know and remember the “sa” account password you entered when Prism initially installed MSDE. If MSDE was installed outside of the Prism installation, then you must know both the “sa” account name password that was used for the MSDE installation.

 

Syntax for Windows authentication:

osql –S <enter database server name from registry> –d <enter database name from registry> -i<path to .sql file> –E

 

Example:

osql –S PrismSQL\SW_DEPLOY_SERVER –d Prism_Deploy_Sample_E557A70E-7566-4265-8FA2-2A334B9D79D8 –iC:\DellBatteryRecall.sql -E

 

 

Syntax for SQL authentication:

osql –S <enter database server name from registry> –d <enter database name from registry> -i<path to .sql file> –U sa

(You will be prompted for the “sa” account password.)

 

Example:

osql –S PrismSQL\SW_DEPLOY_SERVER –d Prism_Deploy_Sample_E557A70E-7566-4265-8FA2-2A334B9D79D8 –iC:\DellBatteryRecall.sql –U sa

 

 

Explanation of parameters

Parameters are case-sensitive.

 

-S refers to SQL database server.

-d refers to the Channel database name

-i refers to the input file (.sql) received from Technical Support. There is no space between that parameter and the path to the .sql file.