- Hands-Off Deployment of SQL Server
- Defining the Header Information for Our Script
- Checking for the Existence of Our Variables
- Cleaning Up the Code
- Summary
Defining the Header Information for Our Script
Once again, we have general header information for our script (see Listing 1), but I am sure you know what all this code means by now. Just make sure that any comments or specific company information is held within the header for other script writers later on.
Listing 1Header Information for Our SP2 Script.
@echo off REM ********************************************************************************************* REM Code provided by InformIT (http://www.informit.com) as part of a series of articles REM REM Script Name: InstallSQLServerSP2.bat REM Script Purpose: Installs Microsoft SQL Server 2000 SP2. REM Version: 1.0 REM Last Updated By: Rob Hawthorne on 1st march 2003 REM Version Info: n\a REM REM Notes: This script is dependant on the successful installation of SQL Server 2000 REM REM Usage: Used to perform a custom install of SQL Server 2000 SP2. REM REM Input Parameters: REM REM SQLsaPwd - The password for the sa account. Note the .iss file encrypts this REM e.g., password REM NTAuthentication -(Optional) Connect to the server with the current REM logged on user's credentials or use SQL Server credentials REM e.g., Yes or No REM - Default Value = Yes REM AppPath - The path to the SQL Server installation files. REM This should be a mapped drive path rather than UNC REM e.g., Y:\sql2k.std\x86\setup REM SQLCollation - (Optional) The collation settings REM (for compatibility with earlier versions of SQL) REM e.g., SQL_Latin1_General_CP1_CI_AS REM - Default Value = SQL_Latin1_General_CP1_CI_AS REM InstanceName - (Optional) The name of the instance you wish to install SQL under. REM If any other name than MSSQLSERVER is specified REM it is treated as a second instance REM e.g., MSSQLSERVER REM - Default Value = MSSQLSERVER REM TCPPort - (Optional) The port you wish SQL server to listen for requests on REM e.g., 1433 REM - Default Value = 1433 REM ISSDir - (Optional) Complete path to the directory where you want the .iss file created REM e.g., %SYSTEMDRIVE%\Temp REM - Default Value = %TEMP% REM LogFile - (Optional) Full path and file name to log output messages REM e.g., %SYSTEMDRIVE%\SQLInstall.log REM - Default Value = %TEMP%\SQLInstall.log REM Return Values: REM RetVal - Return value indicating whether the script has succeeded (0) or not (<> 0) REM e.g., RETVAL=0 REM *********************************************************************************************
Although this header info looks very similar to the installation of SQL Server script (InstallSQLServer.bat), there are a number of parameters specified in the installation script that we don't need to specify in the SP update script. Why? Well, we don't actually need all of the parameters that we would use when installing SQL Server; for example, we don't need the port number that SQL Server listens on.
NOTE
In our earlier script, InstallSQLServer.bat, we specified a number of parameters that by default are not necessarily required to specify. Although you can edit your script so you do not need to provide as many parameters, I did this explicitly so that the scripts that we write are more easily adapted to your specific needs. Otherwise, you need to accept the defaults of the installation program of SQL Server.