码迷,mamicode.com
首页 > 其他好文 > 详细

Security3:Create Schema

时间:2016-01-12 21:18:53      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:

Creates a schema in the current database

The new schema is owned by one of the following database-level principals: database user, database role, or application role. Objects created within a schema are owned by the owner of the schema, and have a NULL principal_id in sys.objects. Ownership of schema-contained objects can be transferred to any database-level principal, but the schema owner always retains CONTROL permission on objects within the schema.

 

Syntax

CREATE SCHEMA schema_name_clause 
<schema_name_clause> ::=
{
schema_name
| schema_name AUTHORIZATION owner_name
}

AUTHORIZATION owner_name

Specifies the name of the database-level principal that will own the schema. This principal may own other schemas, and may not use the current schema as its default schema.


1,example

CREATE LOGIN TestLoginName
with password=J345#$)thb
,DEFAULT_DATABASE = db_study
go


CREATE USER TestUserName 
FOR LOGIN TestLoginName
WITH DEFAULT_SCHEMA = Test;
go


CREATE SCHEMA Test 
AUTHORIZATION TestUserName;
go

create table test.dt_test
(
id int,
code int
);
go

 

Security3:Create Schema

标签:

原文地址:http://www.cnblogs.com/ljhdo/p/5125250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!