You are here: Re: T-SQL CLOSE Connection to DB « MsSQL Server « IT news, forums, messages
Re: T-SQL CLOSE Connection to DB

Posted by Hugo Kornelis on 05/29/06 00:27

On 27 May 2006 19:48:27 -0700, coosa wrote:

>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.

Hi coosa,

If you want to disconnect YOUR OWN connection to a database, check out
Erland's reply.

If you need to do maintenance but can't because OTHER people still have
open connections to a database, then you might want to use one of the
following

ALTER DATABASE <dbname> SET SINGLE_USER

or

ALTER DATABASE <dbname> SET SINGLE_USER WITH ROLLBACK_IMMEDIATE

The first version will allow curent connection to finish their business
and commit their work. The latter option immediately disconnects all
open conenctions and rolls back any changes from unfinished
transactions.

--
Hugo Kornelis, SQL Server MVP

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация