USE master
GO
CREATE LOGIN user_bfp WITH PASSWORD='He1108392'
GO
CREATE USER user_bfp FOR LOGIN user_bfp WITH DEFAULT_SCHEMA=user_bfp
GO
CREATE LOGIN user_bfp WITH PASSWORD='He1108392'
GO
CREATE USER user_bfp FOR LOGIN user_bfp WITH DEFAULT_SCHEMA=user_bfp
GO
/*用户授权*/
EXEC sp_addrolemember N'db_accessadmin', N'user_bfp';
EXEC sp_addrolemember N'db_owner', N'user_bfp';
GO
/*用户授权*/
EXEC sp_addrolemember N'db_accessadmin', N'user_bfp';
EXEC sp_addrolemember N'db_owner', N'user_bfp';
GO
USE [SSPC_EDT_DB]
GO
CREATE USER user_bfp FOR LOGIN user_bfp WITH DEFAULT_SCHEMA=user_bfp
GO
CREATE SCHEMA user_bfp AUTHORIZATION user_bfp
GO
EXEC sp_addrolemember N'db_accessadmin', N'user_bfp';
EXEC sp_addrolemember N'db_owner', N'user_bfp';
use dbname
exec
sp_addlogin
'用户名'
,
'密码'
,
'默认数据库名'
--添加只允许访问指定表的用户
exec
sp_grantdbaccess
'用户名'
--添加到数据库
GRANT
SELECT
,
INSERT
,
UPDATE
,
EXECUTE
TO
[用户名]