T-SQL CLOSE与DB的连接 [英] T-SQL CLOSE Connection to DB
问题描述
如何使用t-sql关闭与数据库的当前连接?
我失败了一段时间后放弃数据库获取它当前的消息
在使用中。
使用向导删除数据库,我可以检查选项
关闭所有与db的连接,但是我如何使用t-sql好的问候
coosa(co ***** @ gmail) .com)写道:如何使用t-sql关闭与数据库的当前连接?
USE< someotherdb>
-
Erland Sommarskog,SQL Server MVP, es *** *@sommarskog.se
SQL Server 2005联机丛书
http://www.microsoft.com/technet/pro...ads/books.mspx
联机丛书f或者SQL Server 2000在
http:// www .microsoft.com / sql / prodinf ... ons / books.mspx
我确实做过,
USE [Master];
GO
IF EXISTS(SELECT name from sys.databases WHERE name = N''MyDB'')
BEGIN
PRINT N''Database [MyDB]已经存在'';
DROP DATABASE MyDB;
END
GO
类似的,是否有像''disconnect'这样的命令,例如在DB2中?
>
How do i close a current connection to a database using t-sql?
I fail some time to drop the database getting messages that it''s
currently in use.
Using the wizard to delete the database, i could check the option to
close all connections to the db, but how do i do it using t-sql?
best regards
coosa (co*****@gmail.com) writes:How do i close a current connection to a database using t-sql?
USE <someotherdb>
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
I did actually,
USE [Master];
GO
IF EXISTS (SELECT name FROM sys.databases WHERE name = N''MyDB'')
BEGIN
PRINT N''Database [MyDB] already exists'';
DROP DATABASE MyDB;
END
GO
Similary, is there a similar command like ''disconnect'' such as in DB2?
这篇关于T-SQL CLOSE与DB的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!