This Domain(Admin5.com) is for Sale:

处理孤立用户的数据库存储过程

时间:2007-11-09  来源:不详  作者:迈克DB
CREATE PROCEDURE [LoneUser]
--INPUT
@DBName nvarchar(50),
@UserName nvarchar(50)
AS
Exec sp_configure 'allow updates','1'
RECONFIGURE WITH OVERRIDE

Declare @ExecStr nvarchar(4000)

Select @ExecStr = ' Declare @b varbinary(85) '
' Use Master'
' Select @b = sid From syslogins Where Name = ''' @UserName ''''
' Use ' @DBName
' Update sysusers Set sid = @b Where name = ''' @UserName ''''

--Print @ExecStr
Exec(@ExecStr)

Exec sp_configure 'allow updates','0'
RECONFIGURE WITH OVERRIDE

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息