views:

107

answers:

4

This is a simple question yet I was unable to find any information at all about this.

Is it possible to have sub-schemas in SQL Server 2005/2008?

Example: Having a HR (Human Resources) schema with a sub-schema called Training (with tables related to this). It would end up like HR.Training.* where * would be the tables.

+5  A: 

No. You could fake this with roles by putting different users into different roles and allowing those roles to use objects.

Mladen Prajdic
+1  A: 

Maybe you could fake it in the naming of the schema, like HR_Training.* and HR_Reviews.* and so forth. Cheesy, I know.

Oliver
+1  A: 

Are you coming from an Oracle background by any chance ? Oracle has the concept of Schemas I believe. In SQL Server the closest equivalent is a Database.

You can cross-query from one database to another on the same SQL server very easily and that would give you virtually the same kind of calling syntax

e.g server.database.owner.object

In you case it might look like HRSvr.HR.dbo.xxx and HRSvr.Training.dbo.xxxx.

Chris
Ah, thanks. I didn't know that.I didn't come from a Oracle background but I did study it some time ago.
Maushu
actually "owner" seems to these days also be called schema, or maybe schema owner ? I am a bit out of touch with the latest / greatest SQL server terminology but I am sure this is well documented in books online. Anyhow, there are a number of ways to achieve what you want I think.
Chris
A: 

Can you please say in normal cases dbo stands for what? owner or database?

sam
DBO stands for DataBase Owner.Next time please start a new question, Stack Overflow is not a forum. Thanks.
Maushu