/** 分配权限 **/
use [master]
create login [ln-tf\liaobin] from windows;
go
grant
control server to [ln-tf\liaobin]; --授予管理员完全控制权限
go
create login [ln-tf\shipping staff] from windows
with
default_database=[db_packs];
go
use [db_packs];
go
create user ln_shp for login [ln-tf\shipping
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-tf\liaobin] from
windows
with default_database=demo1;
go
/** SQL 2000 分配权限 **/
use [db_packs];
go
sp_adduser @loginame =
‘ln-tf\liaobin‘
go
use [master]
EXEC sp_grantlogin [ln-tf\liaobin];
go
grant all to
[ln-tf\liaobin] with grant option; --授予管理员完全控制权限
go
EXEC sp_grantlogin
[ln-tf\shipping staff];
go
-- 授予包装部表操作权限
grant select,delete,update,insert on db_packs to
[ln-tf\shipping staff];
go