Database reference - AdventureWorks

AdventureWorks -  tables -  [Production].[Document]

Description

Product maintenance documents. 

Table properties

namevalue
name[Production].[Document]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count9
Size of data344 kb
Size of indexes24 kb
Maximum size of a single row4,294,969,163 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
DocumentIDint identity(1,1)104 no  yes    no  Primary key for Document records. 
Titlenvarchar(50)50200 no      no  Title of the document. 
FileNamenvarchar(400)4001600 no      no  Directory path and 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. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
AK_Document_FileName_Revisionnonclustered, unique located on PRIMARYFileName, RevisionUnique nonclustered index. 
PK_Document_DocumentIDclustered, unique, primary key located on PRIMARYDocumentIDClustered index created by a primary key constraint. 

Referenced by

name
ProductDocument

Foreign key graph

DocumentProductDocument

Check constraints

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

Defaults

default namecolumncomment
DF_Document_ChangeNumberChangeNumberDefault constraint value of 0 
DF_Document_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_Document_ChangeNumberDF_Document_ModifiedDateDocumentCK_Document_StatusAK_Document_FileName_Revision...PK_Document_DocumentID

Sample rows

DocumentIDTitleFileNameFileExtensionRevisionChangeNumberStatusDocumentSummaryDocumentModifiedDate
Crank Arm and Tire Maintenance  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  0   NULL  System.Byte[]  11/20/2002 9:56:38 AM 
Front Reflector Bracket and Reflector Assembly 3  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  3   25  NULL  System.Byte[]  6/1/2002 12:00:00 AM 
Front Reflector Bracket Installation  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  1   15  Reflectors are vital safety components of your bicycle. Always ensure your front and back reflectors...  System.Byte[]  6/1/2002 12:00:00 AM 
Installing Replacement Pedals  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  0   32  Detailed instructions for replacing pedals with Adventure Works Cycles replacement pedals. Instruct...  System.Byte[]  6/1/2002 12:00:00 AM 
Introduction 1  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  4   28  NULL  System.Byte[]  7/1/2003 12:00:00 AM 
Lubrication Maintenance  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  2   11  Guidelines and recommendations for lubricating the required components of your Adventure Works Cycle...  System.Byte[]  7/1/2003 12:00:00 AM 
Repair and Service Guidelines  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  0   It is important that you maintain your bicycle and keep it in good repair. Detailed repair and servi...  System.Byte[]  5/2/1998 12:00:00 AM 
Seat Assembly  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  8   55  Worn or damaged seats can be easily replaced following these simple instructions. Instructions are ...  System.Byte[]  6/1/2003 12:00:00 AM 
Training Wheels 2  C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text ...  .doc  1   288  NULL  System.Byte[]  7/1/2003 12:00:00 AM 

Code

CREATE TABLE [Production].[Document](
    [DocumentID] [int] IDENTITY(1,1) NOT NULL,
    [Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS 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,
    [DocumentID] [int] IDENTITY(1,1) NOT NULL,
    [Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [FileExtension] [nvarchar](8) 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) NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Document_DocumentID] PRIMARY KEY CLUSTERED 
(
    [DocumentID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

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_ChangeNumber]  DEFAULT ((0)) FOR [ChangeNumber]
ALTER TABLE [Production].[Document] ADD  CONSTRAINT [DF_Document_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]

Powered by Yoyodyne © 1971