SQL Server essence

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

--How to grant a user the access to create a table in a new schema

use tempdb
go

 

create login u1 with password = 'Mdfjd$sakj943857l7sdfh##30'
create user u1 with default_schema = u1

go

 

grant create table to u1
go

create schema sch1
go

create schema u1 authorization u1
go

execute as user = 'u1'
go

create table t1(c1 int)
go

revert
go

select user_name(uid) , * from sysobjects where name = 't1'
go

 

 

The following BOL topics is strongly recommened:

·         User schema separation (http://msdn2.microsoft.com/en-us/library/ms190387.aspx)

·         CREATE TABLE (http://msdn2.microsoft.com/en-us/library/ms174979.aspx)

·         ALTER SCHEMA (http://msdn2.microsoft.com/en-us/library/ms173423.aspx)

 

posted on 2009-03-18 12:02  天蝎  阅读(251)  评论(0编辑  收藏  举报