cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
razmik
Level 3

SQL Server 2005 - create sql standard user

Hi,
The following code used to create a Standard SQL account in SQL 2000. Similar code to create NT account still works. But now it is failing. I have switched to IS 2009. Is there a new way to create a SQL Server Standard account?

Code
-------
function CreateSQLUser(szServerName, szUserName, szPassword, szLoginType, bVerbose)
OBJECT oSQLServer, oLogin, oSQLRole;
begin

set oSQLServer = CreateObject('SQLDMO.SQLServer');
oSQLServer.LoginSecure = TRUE;
oSQLServer.Connect ("(local)" );

set oLogin = CreateObject('SQLDMO.Login');
oLogin.Name = szUserName;
oLogin.SetPassword("", szPassword);
// Login Types: 0 - SQLDMOLogin_NTUser
// 1 - SQLDMOLogin_NTGroup
// 2 - SQLDMOLogin_Standard
oLogin.Type = 2;
oSQLServer.Logins.Add(oLogin);
Labels (1)
0 Kudos
(1) Reply
pradana
Level 6

Why don't you create an SQL user by using SQL script?
0 Kudos