USE [Spconfig]
GO
 
Create LOGIN [login_user1] WITH
PASSWORD=N'login_user1_pwd' MUST_CHANGE,
DEFAULT_DATABASE=[Spconfig],
CHECK_EXPIRATION=ON,
CHECK_POLICY=ON
GO
 
Create USER [db_user1] FOR LOGIN [login_user1]
GO
 
Alter AUTHORIZATION ON SCHEMA::[db_owner] TO [db_user1]
GO
 
EXEC sp_addrolemember N'db_owner', N'db_user1'
GO
参见:《Sql Server用户名和登录名的关系总结》

本文链接地址: 用SQL脚本为SQL 2008添加登录名,数据库用户名及其映射
http://qingfengju.com/index.asp?id=298

分类:数据库 查看次数:4104 发布时间:2012-8-14 21:12:21