-------------------------------------
-------DB User ----------------------
--sp_addlogin Creates a new SQL Server login that allows a user to connect to an instance of SQL Server by using SQL Server authentication.
-- EXEC sp_addlogin 'login name', 'Password', 'Database'
EXEC sp_addlogin 'dentry','dentry','doris'
----online Database Name------
use doris
--sp_adduser Adds a new user to the current database.
--EXEC sp_adduser 'login name', 'User name'
EXEC sp_adduser 'dentry','dentry'
--sp_addrolemember Adds a database user, database role, Windows login, or Windows group to a database role in the current database.
--EXEC sp_addrolemember 'DB role', 'User'
EXEC sp_addrolemember 'operator','dentry'
print 'user data entry created successfully'
--add new role in db
EXEC sp_addrole 'Managers'
-------DB User ----------------------
--sp_addlogin Creates a new SQL Server login that allows a user to connect to an instance of SQL Server by using SQL Server authentication.
-- EXEC sp_addlogin 'login name', 'Password', 'Database'
EXEC sp_addlogin 'dentry','dentry','doris'
----online Database Name------
use doris
--sp_adduser Adds a new user to the current database.
--EXEC sp_adduser 'login name', 'User name'
EXEC sp_adduser 'dentry','dentry'
--sp_addrolemember Adds a database user, database role, Windows login, or Windows group to a database role in the current database.
--EXEC sp_addrolemember 'DB role', 'User'
EXEC sp_addrolemember 'operator','dentry'
print 'user data entry created successfully'
--add new role in db
EXEC sp_addrole 'Managers'
No comments:
Post a Comment