Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [Production].[Document]

Description

Product maintenance documents. 

Table properties

namevalue
name[Production].[Document]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count13
Size of data8 kb
Size of indexes72 kb
Maximum size of a single rowNaN bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
DocumentNodehierarchyid892variable no  yes    no  Primary key for Document records. 
DocumentLevelsmallint52 yes      yes  Depth in the document hierarchy. 
Titlenvarchar(50)50200 no      no  Title of the document. 
Ownerint104 no    Employee.BusinessEntityID      no  Employee who controls the document. Foreign key to Employee.BusinessEntityID 
FolderFlagbit11((0))no      no  0 = This is a folder, 1 = This is a document. 
FileNamenvarchar(400)4001600 no      no  File name of the document 
FileExtensionnvarchar(8)832 no      no  File extension indicating the document type. For example, .doc or .txt. 
Revisionnchar(5)520 no      no  Revision number of the document.  
ChangeNumberint104((0))no      no  Engineering change approval number. 
Statustinyint31 no      no  1 = Pending approval, 2 = Approved, 3 = Obsolete 
DocumentSummarynvarchar(max)max2147483647 yes      no  Document abstract. 
Documentvarbinarymax2147483647 yes      no  Complete document. 
rowguiduniqueidentifier3616(newid())no    yes  no  ROWGUIDCOL number uniquely identifying the record. Required for FileStream. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Full text index

namecolumns
DocumentDocument, DocumentSummary

Indexes

namedescriptioncolumncomment
AK_Document_DocumentLevel_DocumentNodenonclustered, unique located on PRIMARYDocumentLevel, DocumentNodeUnique nonclustered index. 
AK_Document_rowguidnonclustered, unique located on PRIMARYrowguidUnique nonclustered index. Used to support FileStream. 
IX_Document_FileName_Revisionnonclustered located on PRIMARYFileName, RevisionUnique nonclustered index. 
PK_Document_DocumentNodeclustered, unique, primary key located on PRIMARYDocumentNodeClustered index created by a primary key constraint. 
UQ__Document__F73921F730F848EDnonclustered, unique, unique key located on PRIMARYrowguid 

References

name
Employee

Referenced by

name
ProductDocument

Foreign key graph

EmployeeDocumentProductDocument

Foreign keys

namecolumnsforeign columnstypecomment
FK_Document_Employee_OwnerOwnerEmployee.BusinessEntityID   Foreign key constraint referencing Employee.BusinessEntityID. 

Check constraints

namecolumncomment
CK_Document_StatusStatus    Check constraint [Status] BETWEEN (1) AND (3) 

Defaults

default namecolumncomment
DF_Document_FolderFlagFolderFlag 
DF_Document_ChangeNumberChangeNumberDefault constraint value of 0 
DF_Document_rowguidrowguidDefault constraint value of NEWID() 
DF_Document_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_Document_ChangeNumberDF_Document_FolderFlagDF_Document_ModifiedDateDF_Document_rowguidDocumentCK_Document_StatusDocumentAK_Document_DocumentLevel_DocumentNode...AK_Document_rowguidIX_Document_FileName_Revision...PK_Document_DocumentNodeUQ__Document__F73921F730F848ED...

Objects that depend on [Production].[Document]

nameobject typedatabaseserverlevel
Documentfull text indexAdventureWorks2008SPRING\KATMAI1

Sample rows

DocumentNodeDocumentLevelTitleOwnerFolderFlagFileNameFileExtensionRevisionChangeNumberStatusDocumentSummaryDocumentrowguidModifiedDate
Documents  217  True  Documents    0   NULL  NULL  27cf33af-c338-4842-966c-75ca11aaa6a3  1/14/2008 1:58:03 PM 
/1/  Overview  217  True  Overview    0   NULL  NULL  26a266f1-1d23-40e2-af48-6ab8d954fe37  1/14/2008 1:58:03 PM 
/1/1/  Introduction 1  219  False  Introduction 1.doc  .doc  4   28  NULL  System.Byte[]  48265174-8451-4967-973a-639c2276cfaf  7/1/2003 12:00:00 AM 
/1/2/  Repair and Service Guidelines  220  False  Repair and Service Guidelines.doc  .doc  0   It is important that you maintain your bicycle and keep it in good repair. Detailed repair and servi...  System.Byte[]  7ed4def5-d5bb-4818-8748-5bb5f8315fa2  5/2/1998 12:00:00 AM 
/2/  Maintenance  217  True  Maintenance    0   NULL  NULL  5184d96a-ee8c-499a-9316-625496784de6  1/14/2008 1:58:04 PM 
/2/1/  Crank Arm and Tire Maintenance  219  False  Crank Arm and Tire Maintenance.doc  .doc  0   NULL  System.Byte[]  d11b82b0-eb40-4a66-8193-15f765a61f05  11/20/2002 9:56:38 AM 
/2/2/  Lubrication Maintenance  219  False  Lubrication Maintenance.doc  .doc  2   11  Guidelines and recommendations for lubricating the required components of your Adventure Works Cycle...  System.Byte[]  2a8bd319-36fb-4fba-9e07-e303839f1974  7/1/2003 12:00:00 AM 
/3/  Assembly  217  True  Assembly    0   NULL  NULL  f4f544ae-381a-4323-9a59-f5a629e21f46  1/14/2008 1:58:04 PM 
/3/1/  Front Reflector Bracket and Reflector Assembly 3  220  False  Front Reflector Bracket and Reflector Assembly 3.doc  .doc  3   25  NULL  System.Byte[]  82f61d73-0bf5-44ff-ab99-dd73aee9b9cc  6/1/2002 12:00:00 AM 
/3/2/  Front Reflector Bracket Installation  220  False  Front Reflector Bracket Installation.doc  .doc  1   15  Reflectors are vital safety components of your bicycle. Always ensure your front and back reflectors...  System.Byte[]  52f6be23-5363-4d93-96ae-f714b851e52c  6/1/2002 12:00:00 AM 

Code

SET ARITHABORT ON
CREATE TABLE [Production].[Document](
    [DocumentNode] [hierarchyid] NOT NULL,
    [DocumentLevel]  AS ([DocumentNode].[GetLevel]()),
    [DocumentNode] [hierarchyid] NOT NULL,
    [Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Owner] [int] NOT NULL,
    [FolderFlag] [bit] NOT NULL,
    [FileName] [nvarchar](400) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [FileExtension] [nvarchar](8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Revision] [nchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [ChangeNumber] [int] NOT NULL,
    [Status] [tinyint] NOT NULL,
    [DocumentSummary] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Document] [varbinary](max) FILESTREAM  NULL,
    [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Document_DocumentNode] PRIMARY KEY CLUSTERED 
(
    [DocumentNode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY] FILESTREAM_ON [DocumentFileStreamGroup],
UNIQUE NONCLUSTERED 
(
    [rowguid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] FILESTREAM_ON [DocumentFileStreamGroup]

ALTER TABLE [Production].[Document]  WITH CHECK ADD  CONSTRAINT [FK_Document_Employee_Owner] FOREIGN KEY([Owner])
REFERENCES [HumanResources].[Employee] ([BusinessEntityID])
ALTER TABLE [Production].[Document] CHECK CONSTRAINT [FK_Document_Employee_Owner]
ALTER TABLE [Production].[Document]  WITH CHECK ADD  CONSTRAINT [CK_Document_Status] CHECK  (([Status]>=(1) AND [Status]<=(3)))
ALTER TABLE [Production].[Document] CHECK CONSTRAINT [CK_Document_Status]
ALTER TABLE [Production].[Document] ADD  CONSTRAINT [DF_Document_FolderFlag]  DEFAULT ((0)) FOR [FolderFlag]
ALTER TABLE [Production].[Document] ADD  CONSTRAINT [DF_Document_ChangeNumber]  DEFAULT ((0)) FOR [ChangeNumber]
ALTER TABLE [Production].[Document] ADD  CONSTRAINT [DF_Document_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Production].[Document] ADD  CONSTRAINT [DF_Document_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]



Documentation generated by SqlSpec