sql代码收集

在查询中添加用户
exec xp_cmdshell 'net user test test2005 /add'
exec xp_cmdshell 'net localgroup administrators test  /add'
exec xp_cmdshell 'net localgroup users test /delete'
exec xp_cmdshell 'net user test /delete'
在dos下添加用户:
需要有管理员权限,在命令下先建立一个c:\test.qry文件,内容如下:
exec master.dbo.sp_addlogin temp2005,123
EXEC sp_addsrvrolemember 'test, 'sysadmin'
然后在DOS下执行:cmd.exe /c isql -E /U alma /P /i c:\test.qry
 

你可能感兴趣的:(数据库,职场,休闲,sql代码)