SQL 服务器架构和默认架构

编程入门 行业动态 更新时间:2024-10-08 20:40:05
本文介绍了SQL 服务器架构和默认架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的数据库中有一个架构定义.除了现在每次执行 sql 语句时,我都必须提供架构...SELECT * FROM [myschema].table

I have a schema define in my database. Except now everytime I do a sql statement I have to provide the schema ... SELECT * FROM [myschema].table

我使用 management studio 为我的用户设置了默认架构,并运行了ALTER USER myUser WITH DEFAULT_SCHEMA [myschema]在编写没有架构的查询时,我仍然得到无效的对象表"(SELECT * FROM table)

I set the default schema for my user using management studio and also ran the ALTER USER myUser WITH DEFAULT_SCHEMA [myschema] and I still get the invalid object 'table' when writing a query without the schema (SELECT * FROM table)

有没有办法写SELECT * FROM table而不必一直指定模式名称?

Is there a way to write SELECT * FROM table without having to specify the schema name all the time?

它在 SQL 2005 上使用 SQL Management Studio.

It's on SQL 2005 using SQL Management Studio.

推荐答案

用户是否是 SA,如果是这样,将不起作用,根据 documentation SA 用户始终默认使用 dbo 架构.

Is the user an SA, if so it will not work, according to the documentation SA users are always defaulted to the dbo schema.

DEFAULT_SCHEMA 的值被忽略如果用户是sysadmin 固定服务器角色.全部sysadmin 固定服务器的成员角色的默认架构为 dbo.

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 服务器架构和默认架构

本文发布于:2023-11-09 23:29:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573740.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:架构   服务器   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!