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 16:57

On 28 May 2006 18:46:15 -0700, coosa wrote:

>That might be it; some thing remotly is still in use. Then, is there a
>way to determine which connections are being used

Hi coosa,

EXEC sp_who2;

> and wait for them but
>prevent any new connections?

ALTER DATABASE <dbname> SET SINGLE_USER;

(By _not_ adding the WITH ROLLBACK_IMMEDIATE option, you tell SQL Server
to disallow new connections but wait until existing connections are
broken before setting the DB to single user)

Note that many front-end programs keep their connection open, mostly
being idle while the person on the screen enters data, answers a phone
call or visits the water cooler. If you waiting for those connections to
close, you won't have your DB in single-user state before the office
closes.

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

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