PRB: "use database" not working after "create database"
Please help,
I have the following query:
set XACT_ABORT on
begin transaction
create database MY_DB
use MY_DB
commit transaction
The "use" statement fails saying the database does not exists, but I get no
error on the "create". And when I go to the server, sure enough the DB is no
t
there, which it should not be if the TX rolled back. So what is wrong? If th
e
"create" is bad, why do I not see an error on it?You will not see it until you commit the transaction.
set XACT_ABORT on
begin transaction
create database MY_DB
commit transaction
use MY_DB
AMB
"ATS" wrote:
> PRB: "use database" not working after "create database"
> Please help,
> I have the following query:
> set XACT_ABORT on
> begin transaction
> create database MY_DB
> use MY_DB
> commit transaction
> The "use" statement fails saying the database does not exists, but I get n
o
> error on the "create". And when I go to the server, sure enough the DB is
not
> there, which it should not be if the TX rolled back. So what is wrong? If
the
> "create" is bad, why do I not see an error on it?|||Thanks for the reply, but that doesn't work in Query Analyzer.|||Try,
use master
go
create database MY_DB
go
select
*
from
sysdatabases
where
[name] = 'MY_DB'
go
drop database MY_DB
go
AMB
"ATS" wrote:
> Thanks for the reply, but that doesn't work in Query Analyzer.|||One other thing I've noticed. Even with or without TX handling it fails in
Query Analyzer.sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment