Aracılığıyla paylaş


sqloptions:initialDatabase üstbilgi öğesi

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

The sqloptions:initialDatabase SOAP header enables the istemci to specify which database to first connect to, for example:

<SOAP-ENV:Header
  xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
    <sqloptions:initialDatabase           SOAP-ENV:mustUnderstand="1"          value="databaseName"           optional="true" | "false"          filename="databaseFileName" />
    
</SOAP-ENV:Header>

The sqloptions:initialDatabase option appears as a SOAP header.Üstbilgi adında bir öğe oluşur sqloptions:initialDatabase. Öğe bir zorunlu öznitelik sahiptir... value. Bu bir dize değeridir.The value öznitelik specifies the name of the initial database to connect to. Dize yalnızca gibi USE yorumlanır Transact-SQL Command. Öğe iki isteğe bağlı öznitelikleri: optional, (varsayılan değer olan bir Boole değeri olduğu. false) ve filename, (varsayılan değer olan bir dize değeri olan null). The optional öznitelik specifies whether failure to connect to the database should fail. Oturum açma: false oturum açma başarısız; anlamına gelir. true oturum devam anlamına gelir. The filename value gives the file name of the database to attach on login.Bu iliştirilecek veritabanı neden tarafından çıkarılmış bir veritabanını oturum sağlar.

Yalnızca örnek sqloptions:initialDatabase seçeneği, bir istekte bulunabilir.Seçeneği, bir yanıtta bulunamaz.Seçenek birden çok örneğini bir hata üretecektir.

Bitiş noktası isteğini alan varsa, bir varsayılan veritabanı yapılandırılmış, hata oluşur.Güvenlik nedeniyle, istemci belirleyemezsiniz sqloptions:initialDatabase varsayılan bir veritabanı olan bitiş noktası başlığında.

SOAP oturumların kullanılıyorsa, bu seçenek aynı istek görünmelidir initiate sqloptions:sqlsession özniteliği.Bu seçenek, herhangi bir istekle görünürse bir sqloptions:sqlSession Ayrıca içermeyen başlığıbaşlatma öznitelik, hata oluşur.

Aşağıdaki için şemanın bir parçası olan sqloptions:initialDatabase option:

<xs:element name="initialDatabase" form="qualified">
    <xs:annotation>
        <xs:documentation>
            Set initial database on login.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType>
        <xs:attribute use="required" name="value" type="xs:string" form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    The name of the initial database to attach to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute
          name="optional"
          default="false"
          type="xs:boolean"
          form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    Whether the initial database is optional or not.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="filename" type="xs:string" form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    The filename of the database to attach.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:element>

Örnekler

Kullanım örnekleri aşağıdadır sqloptions:initialDatabase istek ve yanıt iletilerinde SOAP üstbilgisi.

Isteği

<SOAP-ENV:Envelope xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:sql="https://schemas.microsoft.com/sqlserver/2004/SOAP"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:sqlparam="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlParameter"
                   xmlns:sqlsoaptypes="https://schemas.microsoft.com/sqlserver/2004/SOAP/types"
                   xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
  <SOAP-ENV:Header>
    <sqloptions:initialDatabase SOAP-ENV:mustUnderstand="1" 
                                value="dbTestForAttaching" 
                                optional="false" 
                                filename="!DBDATADIR!\dbTestForAttaching.mdf" />
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <sql:sqlbatch>
      <sql:BatchCommands>
        SELECT name FROM sys.databases WHERE database_id=(SELECT dbid FROM master.dbo.sysprocesses WHERE spid=@@spid)
        SELECT TOP 1 object_id FROM sys.objects WHERE object_id=(SELECT TOP 1 object_id FROM dbTestForAttaching.sys.objects)
      </sql:BatchCommands>
    </sql:sqlbatch>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Yanıt

<SOAP-ENV:Envelope xml:space="preserve" 
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                   xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/" 
                   xmlns:sql="https://schemas.microsoft.com/sqlserver/2004/SOAP" 
                   xmlns:sqlsoaptypes="https://schemas.microsoft.com/sqlserver/2004/SOAP/types" 
                   xmlns:sqlrowcount="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlRowCount" 
                   xmlns:sqlmessage="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlMessage" 
                   xmlns:sqlresultstream="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlResultStream" 
                   xmlns:sqltransaction="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlTransaction" 
                   xmlns:sqltypes="https://schemas.microsoft.com/sqlserver/2004/sqltypes">
  <SOAP-ENV:Body>
    <sql:sqlbatchResponse>
      <sql:sqlbatchResult>
        <sqlresultstream:SqlRowSet xsi:type="sqlsoaptypes:SqlRowSet">
          <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
            <SqlRowSet1 xmlns="urn:schemas-microsoft-com:sql:SqlRowSet1">
              <row>
                <name>dbTestForAttaching</name>
              </row>
            </SqlRowSet1>
          </diffgr:diffgram>
        </sqlresultstream:SqlRowSet>
        <sqlresultstream:SqlRowCount xsi:type="sqlrowcount:SqlRowCount">
          <sqlrowcount:Count>1</sqlrowcount:Count>
        </sqlresultstream:SqlRowCount>
        <sqlresultstream:SqlRowSet xsi:type="sqlsoaptypes:SqlRowSet">
          <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
            <SqlRowSet2 xmlns="urn:schemas-microsoft-com:sql:SqlRowSet2">
              <row>
                <object_id>val</object_id>
              </row>
            </SqlRowSet2>
          </diffgr:diffgram>
        </sqlresultstream:SqlRowSet>
        <sqlresultstream:SqlRowCount xsi:type="sqlrowcount:SqlRowCount">
          <sqlrowcount:Count>1</sqlrowcount:Count>
        </sqlresultstream:SqlRowCount>
      </sql:sqlbatchResult>
    </sql:sqlbatchResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

See Also

Reference