开发者

SQL Server dbo and schema

I've stumbled across some odd T-SQL code in SQL Server 2005, which I'm trying to understand how it could work.

If there are two tables called tblScenario in two separate schemas, one is in Cache schema and the other i开发者_开发百科s in Dimension schema.

What would we expect to find when we query SELECT * FROM dbo.tblScenario? How does dbo map to one of these schemas in a reliable and predicable way?

For some reason this actually works however we don't know why?

We are going to fix it so it is explicitly calling SELECT * FROM Dimension.tblScenario, but I was curious.

Thanks,

Philip


OLTP Check... 1) is DBO.tblScenario a view?

Othewise, it sounds like you're dealing with SQL Server Analysis Services (SSAS), which deals with dimensions, mimicing tables, etc. More info: http://technet.microsoft.com/en-us/library/cc966452.aspx


If you are running the old version of the query in the Dimension schema I would expect it to return data from the Dimension schema, if you are running it in the Cache schema I would expect it to return data from the Cache schema, and if you are running it from any other schema I would expect it to return an error (similar to that recorded by Chris Diver).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜