I am creating a database in SQL Server 2005 and cannot remember the "CREATE SCHEMA" statment, if that's it, to create a new schema similar to ".dbo". I did it last night, but I cannot remember how and cannot find the article. What I'm trying to accomplish is a database organization like that of the AdventureWorks database where the tables are separated into: Person.Contact, Person.*, HumanResources.blah, Other.Blah, etc. It's an easy question I'm sure...I just can't remember. Thanks in advance!
+3
A:
It's CREATE SCHEMA More info here: http://msdn.microsoft.com/en-us/library/ms189462.aspx
rdkleine
2009-09-12 20:58:26
No, I just want to separate my database tables with prefixes on the names, similar to that of the MS AdventureWorks sample database: Person.Contact, Person.ContactType... instead of dbo.Contact, dbo.ContactType, etc...it's a one-line tSQL command I cannot remember or find
Justin
2009-09-12 21:03:31
AdventureWorks uses schemas. Why are you saying that `create schema Person` isn't it?
Eric
2009-09-12 21:07:33
(+1) The syntax you are probably after is: `Create Schema [Person] Authorization [dbo];`
Chris Nielsen
2009-09-12 21:08:04
@Unknown: First create a schema Person (CREATE SCHEMA Person) then create a table Contact using the schema Person (CREATE TABLE Person.Contact etc). Then you'll get Person.Contact
rdkleine
2009-09-12 21:13:47
Chris, that's exactly what I was looking for. Thanks!!!
Justin
2009-09-26 19:25:14