In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to delete the current database connection users, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know about it.
USE master
Go
IF EXISTS (SELECT *
FROM dbo.sysobjects
WHERE id = OBJECT_ID (N' [dbo]. [P_KillConnections]')
AND OBJECTPROPERTY (id, NissIsProcedure') = 1)
DROP PROCEDURE [dbo]. [P_KillConnections]
GO
CREATE PROC P_KillConnections @ dbname VARCHAR
AS
DECLARE @ sql NVARCHAR
DECLARE @ spid NVARCHAR (20)
DECLARE # tb CURSOR FOR
SELECT spid=CAST (spid AS VARCHAR 20) FROM master..sysprocesses WHERE dbid=DB_ID (@ dbname)
OPEN # tb
FETCH NEXT FROM # tb INTO @ spid
WHILE @ @ fetch_status = 0
BEGIN
EXEC ('kill' + @ spid)
FETCH NEXT FROM # tb INTO @ spid
END
CLOSE # tb
DEALLOCATE # tb
Go
-- modify it
EXEC P_KillConnections'# # enter your DBNAME
Thank you for reading this article carefully. I hope the article "how to delete the current database connection user" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.