SQL Server enables users to establish tables and stored procedures only under a schema

Source: Internet
Author: User
1. First, after a user is established, the default schema is dbo, and the default role is public. In this case, the user will not see the dbo and other objects under the schema. Unless authorized separately. 2. Create a new schema test, and then make the owner of the schema the user created above, and set the default schema for this user as test. Then, the new user will have all the permissions of the test schema object. At this point, however, the user does not have permission to establish tables and stored procedures. 3. Grant permissions for this new user table and stored procedure: use TestDB;
GRANT CREATE TABLE to ABC;
GRANT Create PROCEDURE to ABC so that this user will have permissions to create new tables and users. However, because this user has only the permissions of the test schema, only the tables and stored procedures of the test schema can be established. Since the default schema for this user is test, it is built with the test schema when the table is created. 4. If you want users to be able to create objects of other schemas, then you need to grant this user ALTER permission on the new schema. If you want this user to see objects inside the new schema, grant the view DEFINITION permission for the new schema for this user. 5, the above is said to use the statement to establish the method. Note There are some differences when using SQL Server client tools to build tables and stored procedures. Building a table from the graphical interface gives an error indicating that only administrators and database owners have permission to do so. This is only because of the temporary data to be stored in the system table, can be ignored, so it is just to generate the statement and execution of the table, these operations are OK, no problem. So that error can be ignored.

SQL Server enables users to establish tables and stored procedures only under a schema

Related Article

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.