/** 分配权限 **/
use [master]
create login [ln-tfliaobin] from windows;
go
grant
control server to [ln-tfliaobin]; --授予管理员完全控制权限
go
create login [ln-tfshipping staff] from windows
with
default_database=[db_packs];
go
use [db_packs];
go
create user ln_shp for login [ln-tfshipping
staff];
go
-- 授予包装部表操作权限
grant select,delete,update,insert on
database::db_packs to [ln_shp];
go
use [master];
go
create database [demo1];
go
use
[demo1];
go
create schema sch_demo1;
go
create table table1(tid
int);
create table table2(tid int);
go
create table
sch_demo1.table3(tid int);
go
create login [ln-tfliaobin] from
windows
with default_database=demo1;
go
/** SQL 2000 分配权限 **/
use [db_packs];
go
sp_adduser @loginame =
'ln-tfliaobin'
go
use [master]
EXEC sp_grantlogin [ln-tfliaobin];
go
grant all to
[ln-tfliaobin] with grant option; --授予管理员完全控制权限
go
EXEC sp_grantlogin
[ln-tfshipping staff];
go
-- 授予包装部表操作权限
grant select,delete,update,insert on db_packs to
[ln-tfshipping staff];
go