Export (0) Print
Expand All

Lesson 1: Creating the Databases

New: 15 September 2007

In this lesson, you will learn to create the databases and enable the trustworthy option.

Create the databases and set the trustworthy option
  1. Copy and paste the following code into a Query Editor window. Then, run it to create the databases for this tutorial. By default, new databases have the ENABLE_BROKER option set to on. Setting the TRUSTWORTHY option in the InitiatorDB lets you start conversations in that database that reference target services in the TargetDB.

    USE master;
    GO
    
    IF EXISTS (SELECT * FROM sys.databases
               WHERE name = N'TargetDB')
         DROP DATABASE TargetDB;
    GO
    CREATE DATABASE TargetDB;
    GO
    
    IF EXISTS (SELECT * FROM sys.databases
               WHERE name = N'InitiatorDB')
         DROP DATABASE InitiatorDB;
    GO
    CREATE DATABASE InitiatorDB;
    GO
    ALTER DATABASE InitiatorDB SET TRUSTWORTHY ON;
    GO
    

You have successfully created the databases that will be used for the tutorial. Next, you will configure the TargetDB with the objects that are required to support the target end of a Service Broker Conversation. See Lesson 2: Creating the Target Conversation Objects.

Community Additions

ADD
Show:
© 2014 Microsoft