如何在 SQL Server 2005 中设置数据库的默认架构? [英] How to set the default schema of a database in SQL Server 2005?
本文介绍了如何在 SQL Server 2005 中设置数据库的默认架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下行有效:
SELECT * FROM [myschema].users
但这不会:
SELECT * FROM users
推荐答案
默认架构是特定于用户的:
A default schema is user-specific:
USE yourDatabase;
ALTER USER [yourUser] WITH DEFAULT_SCHEMA = myschema;
有关ALTER TABLE的更多信息a> for SQL 2005 也可能对您有所帮助.
More information about the ALTER TABLE for SQL 2005 might help you as well.
由于这是特定于用户的,如果您有多个用户,则需要为要更新其默认架构的每个用户执行此查询(在每个数据库上).
As this is user-specific, if you have multiple users, you will need to execute this query (on each database) for each user whose default schema you want to update.
需要注意的是:
The value of DEFAULT_SCHEMA is ignored if the user is a member of the sysadmin
fixed server role. All members of the sysadmin fixed server role have a default
schema of dbo.
这篇关于如何在 SQL Server 2005 中设置数据库的默认架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文