views:

190

answers:

1

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
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
AdventureWorks uses schemas. Why are you saying that `create schema Person` isn't it?
Eric
(+1) The syntax you are probably after is: `Create Schema [Person] Authorization [dbo];`
Chris Nielsen
@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
Chris, that's exactly what I was looking for. Thanks!!!
Justin