Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Fri, 26 May 2006 22:41:33 +0000 (UTC)
(zunilp@xxxxxxxxx) writes:
Till now I am using SQL server 2000 with SQLOLEDB. Everything is fine.
But now I moved to SQLServer 2005 with SQLNCLI provider. But it throws
an error "CREATE DATABASE statement not allowed within multi-statement
transaction" when our application tries to create a new DB inside a
transaction. All other DDL statements like CREATE TABLE, ALTER etc
works well inside a transaction with SQLNCLI. We found that only CREATE
DATABASE has problem.
This problem is not there with SQLOLEDB.
I know such a problem is there with SYBASE in which by defaukt sybase
wn't allow DDL statements inside a transaction. But they provide an
option DDL_IN_TRAN or something like that. Enabling this will allow
DDL.
How I can make CREATE DATBASE work inside a transaction. Is there any
options available.
No. Books Online for SQL 2000 says in the topic "Transact-SQL Statements
Allowed in Transactions":
You can use all Transact-SQL statements in a transaction, except
for the following statements
ALTER DATABASE LOAD DATABASE
BACKUP LOG LOAD TRANSACTION
CREATE DATABASE RECONFIGURE
DISK INIT RESTORE DATABASE
DROP DATABASE RESTORE LOG
DUMP TRANSACTION UPDATE STATISTICS
In the SQL 2005 you find the same topic on
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/ffadadc1-ed01-46a7-923d-bd583141a6cb.htm
I don't know why your code seemed to work with SQOLEDB, but apparently
you were not creating databases within a transaction then.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- References:
- Prev by Date: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- Next by Date: Re: C++, OLEDb, Bulkcopy
- Previous by thread: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- Next by thread: Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- Index(es):
Relevant Pages
|