SQLServer create schema

Source: Internet
Author: User
Schema is very important. You have to create a schema for each data. Sometimes, if you do not specify a schema, the database defaults to the schema name of the currently logged-on user. Why is schema created,
You may think of it as a namespace or architecture. create schema provides methods for creating tables, views, and granting object permissions in SQL statements,
Some people are afraid of the same index name. Therefore, creating a schema is different from the index of another table. At the same time, the index, table, and view are not in the same namespace, this prevents unauthorized users from performing operations.
Why do we need to separate the namespaces? The main benefit is that the query speed of the table is improved. If the index is in the same namespace as the table, the tablespace in the database becomes smaller, because the index occupies space.
This will affect the Table query speed.
Drop schema abpgo/* ====================================== =========================================* // * User: abp * // * = =========================*/create schema abpgoif exists (select 1 from sysobjects where id = object_id ('abc. test') and type = 'U') drop table abp. testGO/* = =========================================* // * Table: test Table * // * ========================================== =========================================== */create table abp. test (aa varchar (50) not null, bb varchar (100) collate Chinese_PRC_CI_AS null, cc int null) on "PRIMARY" GO -- dbo by default, therefore, the system will prompt that the TABLE has no permission -- drop table testDROP TABLE abp. test



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.