欢迎来到福编程网,本站提供各种互联网专业知识!

Sample script that displays all of the users in a given SQL Server DB

发布时间:2007-06-16 作者: 来源:转载
SamplescriptthatdisplaysalloftheusersinagivenSQLServerDB.SupportedPlatformsSQLServer2000YesScriptCode复制代码代码如下:strDBServerName="."strDBName="ScriptingGuysTestDB"SetobjSQLServer=CreateObject("SQLDMO.SQLServer")objSQLServer.Login
SamplescriptthatdisplaysalloftheusersinagivenSQLServerDB.

SupportedPlatforms

SQLServer2000
Yes


ScriptCode

复制代码 代码如下:
strDBServerName="."
strDBName="ScriptingGuysTestDB"

SetobjSQLServer=CreateObject("SQLDMO.SQLServer")
objSQLServer.LoginSecure=True
objSQLServer.ConnectstrDBServerName

SetobjDB=objSQLServer.Databases(strDBName)
SetcolUsers=objDB.Users
ForEachobjUserIncolUsers
WScript.Echo"User:"&objUser.Name
WScript.Echo"Login:"&objUser.Login
Next

相关推荐