1 USE master
2
3 IF NOT EXISTS (SELECT *
4
5 FROM master.dbo.sysdatabases
6
7 WHERE name = 'RelayBookkeeping')
8
9 CREATE DATABASE 'RelayBookkeeping'
10
11 GO
12 注:RelayBookkeeping是我们需要创建的数据库。
Creating a Sample Project that Will Create a SQL Server Catalog by Running Customized SQL Script
TASK
The following describes how to create a sample project that will create a SQL Server catalog on the target machine by running customized SQL script:
Create a new InstallShield project.
Go to the Property Manager view.
Create a new property named "IS_SQLSERVER_DATABASE2".
Go to the SQL Scripts view.
Create a new connection and call it "NewConnection1".
Click NewConnection1 in the explorer, and select the General tab.
Specify "TESTSQLSERVER" as the Target Server Name, and clear the Create Catalog If Absent option.
Select the Server Authentication option and specify "sa" as the Login ID and leave the Password field blank.
Click the Requirements tab.
Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.
Right-click NewConnection1 in the explorer, and choose New Script.
Rename the new script "NewScript1".
Select NewScript1 in the explorer, and click the Script tab.
Add the following script:
CREATE DATABASE [TestDB] ON (NAME = N' TestDB', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL\data\testdb.mdf' ,
SIZE = 3, FILEGROWTH = 10%) LOG ON (NAME = N' TestDB_log', FILENAME
= N'C:\Program Files\Microsoft SQL Server\MSSQL\data\testdb.ldf' ,
SIZE = 1, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
Click the Runtime tab, select Run Script During Login, and then clear the other script execution options.
Create a new connection in the SQL Scripts view, and call it "NewConnection2".
Click NewConnection2 in the explorer, and select the Advanced tab.
From the Target Catalog Property Name box, choose IS_SQLSERVER_DATABASE2.
Click the General tab.
Specify "TESTSQLSERVER" as the Target Server Name and "TestDB" as the Catalog Name, and then clear the Create Catalog If Absent option.
Select the Server Authentication option and specify "sa" as the Login ID and leave the Password field blank.
Click the Requirements tab.
Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.
Right-click NewConnection2 in the explorer, and choose New Script.
Rename the new script "NewScript2".
Select NewScript2 in the explorer, and click the Script tab.
Add the following script:
CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)
Click the Runtime tab, select Run Script During Install, and then clear the other script execution options.
Creating a Sample Project that Will Create an Oracle Catalog by Running Customized SQL Script
TASK
The following describes how to create a sample project that will create an Oracle catalog on the target machine by running customized SQL script:
Create a new InstallShield project.
Go to the Property Manager view.
Create a new property named "IS_SQLSERVER_DATABASE2".
Go to the SQL Scripts view.
Create a new connection and call it "NewConnection1".
Click NewConnection1 in the explorer, and select the General tab.
Specify "//sch01jsmith.macrvision.com:1521/orcl" as the Target Server Name, and clear the Create Catalog If Absent option.
Select the Server Authentication option and specify "Scott" as the login ID and "Scott" as the password.
Click the Requirements tab.
Select the Oracle check box and clear the SQL Server and MySQL check boxes as the target databases.
Right-click NewConnection1 in the explorer, and choose New Script.
Rename the new script "NewScript1".
Select NewScript1 in the explorer, and click the Script tab.
Add the following script:
CREATE TABLESPACE TEST_TS LOGGING DATAFILE ' /muddle/oracle/sts/
test01.dbf ' SIZE 64K AUTOEXTEND ON NEXT 2M MAXSIZE UNLIMITED
Go
CREATE USER TEST_USER IDENTIFIED BY MYPSWD DEFAULT TABLESPACE
TEST_TS QUOTA UNLIMITED on TEST_TS
Go
GRANT CONNECT TO TEST_USER
Go
GRANT DBA TO TEST_USER
Go
ALTER USER TEST_USER DEFAULT ROLE ALL
Go
Click the Runtime tab, select Run Script During Login, and then clear the other script execution options.
Create a new connection in the SQL Scripts view, and call it "NewConnection2".
Click NewConnection2 in the explorer, and select the Advanced tab.
From the Target Catalog Property Name box, choose IS_SQLSERVER_DATABASE2.
Click the General tab.
Specify "//sch01jsmith.macrvision.com:1521/orcl" as the Target Server Name and "TEST_USER" as the Catalog Name, and then clear the Create Catalog If Absent option.
Select the Server Authentication option and specify "TEST_USER" as the Login ID and "MYPSWD" as the password.
Click the Requirements tab.
Select the Oracle check box and clear the SQL Server and MySQL check boxes as the target databases.
Right-click NewConnection2 in the explorer, and choose New Script.
Rename the new script "NewScript2".
Select NewScript2 in the explorer, and click the Script tab.
Add the following script:
CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)
Click the Runtime tab, select Run Script During Install, and then clear the other script execution options.