Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
senthil22
Starting Member
7 Posts |
Posted - 2010-07-07 : 08:29:47
|
Can any one can explain clearly about schema concept. Because, after creating schema i have logged into application using schema's user name while that i am getting same values twice if i check by executing sp i am getting distinct values only. on other hand i have created new database and created new login, i have created related tables,sp's and views now if i logged into the application using this db login i am getting only one values i.e., values are not replicated. Can anyone help me and what mistake i have did? |
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2010-07-07 : 21:59:54
|
A schema is a container for objects - it is really that simple. If I create a schema, than add a table and a stored procedure to that schema - there is no difference between that and creating those same objects with 'dbo'. I just have to reference those objects using the schema.Most likely, your problems relate to having the same object name in multiple schemas. In this situation, if you do not specify the schema when referencing the object it will use the login's default schema to find the object. If the object exists, it uses it - if not, it looks to the 'dbo' schema and uses the object in that schema (if it exists).So, make sure you always use the schema when referencing tables, stored procedures, functions, etc... As in:SELECT ... FROM MyCustomSchema.MyTableOr,EXECUTE MyCustomSchema.MyProcedure; |
 |
|
|
|
|
|
|