<?xml version="1.0"?>
<STDDatabaseSchema><Database name="AdventureWorks" type="SQL Server"><Groups><Group name="t" type="Tables"><Tables><Table name="dbo.AWBuildVersion" file="AdventureWorks_201011112041_dbo.AWBuildVersion.html"><Descriptions><Description type="" text="Current version number of the AdventureWorks sample database. "/></Descriptions><PrimaryKeys><KeyField>SystemInformationID</KeyField></PrimaryKeys><Fields><Field name="SystemInformationID" type="tinyint - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for AWBuildVersion records.</Line></Comment></Comments></Field><Field name="Database Version" type="nvarchar (25)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Version number of the database in 9.yy.mm.dd.00 format.</Line></Comment></Comments></Field><Field name="VersionDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_AWBuildVersion_SystemInformationID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SystemInformationID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys/><Triggers/></Table><Table name="dbo.DatabaseLog" file="AdventureWorks_201011112041_dbo.DatabaseLog.html"><Descriptions><Description type="" text="Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog."/></Descriptions><PrimaryKeys><KeyField>DatabaseLogID</KeyField></PrimaryKeys><Fields><Field name="DatabaseLogID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for DatabaseLog records.</Line></Comment></Comments></Field><Field name="PostTime" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The date and time the DDL change occurred.</Line></Comment></Comments></Field><Field name="DatabaseUser" type="nvarchar (128)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The user who implemented the DDL change.</Line></Comment></Comments></Field><Field name="Event" type="nvarchar (128)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The type of DDL statement that was executed.</Line></Comment></Comments></Field><Field name="Schema" type="nvarchar (128)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The schema to which the changed object belongs.</Line></Comment></Comments></Field><Field name="Object" type="nvarchar (128)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The object that was changed by the DDL statment.</Line></Comment></Comments></Field><Field name="TSQL" type="nvarchar (MAX)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The exact Transact-SQL statement that was executed.</Line></Comment></Comments></Field><Field name="XmlEvent" type="xml" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The raw XML data generated by database trigger.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_DatabaseLog_DatabaseLogID" clustered="No" unique="Yes"><IndexFields><IndexField>DatabaseLogID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys/><Triggers/></Table><Table name="dbo.ErrorLog" file="AdventureWorks_201011112041_dbo.ErrorLog.html"><Descriptions><Description type="" text="Audit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct."/></Descriptions><PrimaryKeys><KeyField>ErrorLogID</KeyField></PrimaryKeys><Fields><Field name="ErrorLogID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ErrorLog records.</Line></Comment></Comments></Field><Field name="ErrorTime" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>The date and time at which the error occurred.</Line></Comment></Comments></Field><Field name="UserName" type="nvarchar (128)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The user who executed the batch in which the error occurred.</Line></Comment></Comments></Field><Field name="ErrorNumber" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The error number of the error that occurred.</Line></Comment></Comments></Field><Field name="ErrorSeverity" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The severity of the error that occurred.</Line></Comment></Comments></Field><Field name="ErrorState" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The state number of the error that occurred.</Line></Comment></Comments></Field><Field name="ErrorProcedure" type="nvarchar (126)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The name of the stored procedure or trigger where the error occurred.</Line></Comment></Comments></Field><Field name="ErrorLine" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The line number at which the error occurred.</Line></Comment></Comments></Field><Field name="ErrorMessage" type="nvarchar (4000)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The message text of the error that occurred.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ErrorLog_ErrorLogID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ErrorLogID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys/><Triggers/></Table><Table name="HumanResources.Department" file="AdventureWorks_201011112041_HumanResources.Department.html"><Descriptions><Description type="" text="Lookup table containing the departments within the Adventure Works Cycles company."/></Descriptions><PrimaryKeys><KeyField>DepartmentID</KeyField></PrimaryKeys><Fields><Field name="DepartmentID" type="smallint - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Department records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Name of the department.</Line></Comment></Comments></Field><Field name="GroupName" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Name of the group to which the department belongs.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Department_DepartmentID" clustered="Yes" unique="Yes"><IndexFields><IndexField>DepartmentID</IndexField></IndexFields></Index><Index name="AK_Department_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_EmployeeDepartmentHistory_Department_DepartmentID" affectedSchema="" affectedTable="HumanResources.EmployeeDepartmentHistory" affectedField="DepartmentID"/></ExternalForeignKeys><Triggers/></Table><Table name="HumanResources.Employee" file="AdventureWorks_201011112041_HumanResources.Employee.html"><Descriptions><Description type="" text="Employee information such as salary, department, and title."/></Descriptions><PrimaryKeys><KeyField>EmployeeID</KeyField></PrimaryKeys><Fields><Field name="EmployeeID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Employee records.</Line></Comment></Comments></Field><Field name="NationalIDNumber" type="nvarchar (15)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unique national identification number such as a social security number.</Line></Comment></Comments></Field><Field name="ContactID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Identifies the employee in the Contact table. Foreign key to Contact.ContactID.</Line></Comment></Comments></Field><Field name="LoginID" type="nvarchar (256)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Network login.</Line></Comment></Comments></Field><Field name="ManagerID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Manager to whom the employee is assigned. Foreign Key to Employee.M</Line></Comment></Comments></Field><Field name="Title" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Work title such as Buyer or Sales Representative.</Line></Comment></Comments></Field><Field name="BirthDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date of birth.</Line></Comment></Comments></Field><Field name="MaritalStatus" type="nchar (1)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>M = Married, S = Single</Line></Comment></Comments></Field><Field name="Gender" type="nchar (1)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>M = Male, F = Female</Line></Comment></Comments></Field><Field name="HireDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Employee hired on this date.</Line></Comment></Comments></Field><Field name="SalariedFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining.</Line></Comment></Comments></Field><Field name="VacationHours" type="smallint" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Number of available vacation hours.</Line></Comment></Comments></Field><Field name="SickLeaveHours" type="smallint" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Number of available sick leave hours.</Line></Comment></Comments></Field><Field name="CurrentFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = Inactive, 1 = Active</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Employee_EmployeeID" clustered="Yes" unique="Yes"><IndexFields><IndexField>EmployeeID</IndexField></IndexFields></Index><Index name="AK_Employee_LoginID" clustered="No" unique="Yes"><IndexFields><IndexField>LoginID</IndexField></IndexFields></Index><Index name="AK_Employee_NationalIDNumber" clustered="No" unique="Yes"><IndexFields><IndexField>NationalIDNumber</IndexField></IndexFields></Index><Index name="AK_Employee_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_Employee_ManagerID" clustered="No" unique="No"><IndexFields><IndexField>ManagerID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Employee_BirthDate" text="([BirthDate]&gt;='1930-01-01' AND [BirthDate]&lt;=dateadd(year,(-18),getdate()))"/><CheckConstraint name="CK_Employee_MaritalStatus" text="(upper([MaritalStatus])='S' OR upper([MaritalStatus])='M')"/><CheckConstraint name="CK_Employee_HireDate" text="([HireDate]&gt;='1996-07-01' AND [HireDate]&lt;=dateadd(day,(1),getdate()))"/><CheckConstraint name="CK_Employee_Gender" text="(upper([Gender])='F' OR upper([Gender])='M')"/><CheckConstraint name="CK_Employee_VacationHours" text="([VacationHours]&gt;=(-40) AND [VacationHours]&lt;=(240))"/><CheckConstraint name="CK_Employee_SickLeaveHours" text="([SickLeaveHours]&gt;=(0) AND [SickLeaveHours]&lt;=(120))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_Employee_Contact_ContactID" affectedField="ContactID" sourceTable="Person.Contact"/><InternalForeignKey name="FK_Employee_Employee_ManagerID" affectedField="ManagerID" sourceTable="HumanResources.Employee"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_Employee_Employee_ManagerID" affectedSchema="" affectedTable="HumanResources.Employee" affectedField="ManagerID"/><ExternalForeignKey name="FK_EmployeeAddress_Employee_EmployeeID" affectedSchema="" affectedTable="HumanResources.EmployeeAddress" affectedField="EmployeeID"/><ExternalForeignKey name="FK_EmployeeDepartmentHistory_Employee_EmployeeID" affectedSchema="" affectedTable="HumanResources.EmployeeDepartmentHistory" affectedField="EmployeeID"/><ExternalForeignKey name="FK_EmployeePayHistory_Employee_EmployeeID" affectedSchema="" affectedTable="HumanResources.EmployeePayHistory" affectedField="EmployeeID"/><ExternalForeignKey name="FK_JobCandidate_Employee_EmployeeID" affectedSchema="" affectedTable="HumanResources.JobCandidate" affectedField="EmployeeID"/><ExternalForeignKey name="FK_PurchaseOrderHeader_Employee_EmployeeID" affectedSchema="" affectedTable="Purchasing.PurchaseOrderHeader" affectedField="EmployeeID"/><ExternalForeignKey name="FK_SalesPerson_Employee_SalesPersonID" affectedSchema="" affectedTable="Sales.SalesPerson" affectedField="SalesPersonID"/></ExternalForeignKeys><Triggers><Trigger name="dEmployee"><Text><Line text="CREATE TRIGGER [HumanResources].[dEmployee] ON [HumanResources].[Employee] "/><Line text="INSTEAD OF DELETE NOT FOR REPLICATION AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN"/><Line text="RAISERROR"/><Line text="(N'Employees cannot be deleted. They can only be marked as not current.', -- Message"/><Line text="10, -- Severity."/><Line text="1); -- State."/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="END;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="HumanResources.EmployeeAddress" file="AdventureWorks_201011112041_HumanResources.EmployeeAddress.html"><Descriptions><Description type="" text="Cross-reference table mapping employees to their address(es)."/></Descriptions><PrimaryKeys><KeyField>EmployeeID</KeyField><KeyField>AddressID</KeyField></PrimaryKeys><Fields><Field name="EmployeeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Employee.EmployeeID.</Line></Comment></Comments></Field><Field name="AddressID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Address.AddressID.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_EmployeeAddress_EmployeeID_AddressID" clustered="Yes" unique="Yes"><IndexFields><IndexField>EmployeeID</IndexField><IndexField>AddressID</IndexField></IndexFields></Index><Index name="AK_EmployeeAddress_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_EmployeeAddress_Address_AddressID" affectedField="AddressID" sourceTable="Person.Address"/><InternalForeignKey name="FK_EmployeeAddress_Employee_EmployeeID" affectedField="EmployeeID" sourceTable="HumanResources.Employee"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="HumanResources.EmployeeDepartmentHistory" file="AdventureWorks_201011112041_HumanResources.EmployeeDepartmentHistory.html"><Descriptions><Description type="" text="Employee department transfers."/></Descriptions><PrimaryKeys><KeyField>EmployeeID</KeyField><KeyField>StartDate</KeyField><KeyField>DepartmentID</KeyField><KeyField>ShiftID</KeyField></PrimaryKeys><Fields><Field name="EmployeeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Employee identification number. Foreign key to Employee.EmployeeID.</Line></Comment></Comments></Field><Field name="DepartmentID" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Department in which the employee worked including currently. Foreign key to Department.DepartmentID.</Line></Comment></Comments></Field><Field name="ShiftID" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date the employee started work in the department.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the employee left the department. NULL = Current department.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID" clustered="Yes" unique="Yes"><IndexFields><IndexField>EmployeeID</IndexField><IndexField>StartDate</IndexField><IndexField>DepartmentID</IndexField><IndexField>ShiftID</IndexField></IndexFields></Index><Index name="IX_EmployeeDepartmentHistory_DepartmentID" clustered="No" unique="No"><IndexFields><IndexField>DepartmentID</IndexField></IndexFields></Index><Index name="IX_EmployeeDepartmentHistory_ShiftID" clustered="No" unique="No"><IndexFields><IndexField>ShiftID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_EmployeeDepartmentHistory_EndDate" text="([EndDate]&gt;=[StartDate] OR [EndDate] IS NULL)"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_EmployeeDepartmentHistory_Department_DepartmentID" affectedField="DepartmentID" sourceTable="HumanResources.Department"/><InternalForeignKey name="FK_EmployeeDepartmentHistory_Employee_EmployeeID" affectedField="EmployeeID" sourceTable="HumanResources.Employee"/><InternalForeignKey name="FK_EmployeeDepartmentHistory_Shift_ShiftID" affectedField="ShiftID" sourceTable="HumanResources.Shift"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="HumanResources.EmployeePayHistory" file="AdventureWorks_201011112041_HumanResources.EmployeePayHistory.html"><Descriptions><Description type="" text="Employee pay history."/></Descriptions><PrimaryKeys><KeyField>EmployeeID</KeyField><KeyField>RateChangeDate</KeyField></PrimaryKeys><Fields><Field name="EmployeeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Employee identification number. Foreign key to Employee.EmployeeID.</Line></Comment></Comments></Field><Field name="RateChangeDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date the change in pay is effective</Line></Comment></Comments></Field><Field name="Rate" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Salary hourly rate.</Line></Comment></Comments></Field><Field name="PayFrequency" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>1 = Salary received monthly, 2 = Salary received biweekly</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_EmployeePayHistory_EmployeeID_RateChangeDate" clustered="Yes" unique="Yes"><IndexFields><IndexField>EmployeeID</IndexField><IndexField>RateChangeDate</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_EmployeePayHistory_PayFrequency" text="([PayFrequency]=(2) OR [PayFrequency]=(1))"/><CheckConstraint name="CK_EmployeePayHistory_Rate" text="([Rate]&gt;=(6.50) AND [Rate]&lt;=(200.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_EmployeePayHistory_Employee_EmployeeID" affectedField="EmployeeID" sourceTable="HumanResources.Employee"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="HumanResources.JobCandidate" file="AdventureWorks_201011112041_HumanResources.JobCandidate.html"><Descriptions><Description type="" text="Résumés submitted to Human Resources by job applicants."/></Descriptions><PrimaryKeys><KeyField>JobCandidateID</KeyField></PrimaryKeys><Fields><Field name="JobCandidateID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for JobCandidate records.</Line></Comment></Comments></Field><Field name="EmployeeID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Employee identification number if applicant was hired. Foreign key to Employee.EmployeeID.</Line></Comment></Comments></Field><Field name="Resume" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Résumé in XML format.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_JobCandidate_JobCandidateID" clustered="Yes" unique="Yes"><IndexFields><IndexField>JobCandidateID</IndexField></IndexFields></Index><Index name="IX_JobCandidate_EmployeeID" clustered="No" unique="No"><IndexFields><IndexField>EmployeeID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_JobCandidate_Employee_EmployeeID" affectedField="EmployeeID" sourceTable="HumanResources.Employee"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="HumanResources.Shift" file="AdventureWorks_201011112041_HumanResources.Shift.html"><Descriptions><Description type="" text="Work shift lookup table."/></Descriptions><PrimaryKeys><KeyField>ShiftID</KeyField></PrimaryKeys><Fields><Field name="ShiftID" type="tinyint - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Shift records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shift description.</Line></Comment></Comments></Field><Field name="StartTime" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shift start time.</Line></Comment></Comments></Field><Field name="EndTime" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shift end time.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Shift_ShiftID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ShiftID</IndexField></IndexFields></Index><Index name="AK_Shift_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_Shift_StartTime_EndTime" clustered="No" unique="Yes"><IndexFields><IndexField>StartTime</IndexField><IndexField>EndTime</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_EmployeeDepartmentHistory_Shift_ShiftID" affectedSchema="" affectedTable="HumanResources.EmployeeDepartmentHistory" affectedField="ShiftID"/></ExternalForeignKeys><Triggers/></Table><Table name="Person.Address" file="AdventureWorks_201011112041_Person.Address.html"><Descriptions><Description type="" text="Street address information for customers, employees, and vendors."/></Descriptions><PrimaryKeys><KeyField>AddressID</KeyField></PrimaryKeys><Fields><Field name="AddressID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Address records.</Line></Comment></Comments></Field><Field name="AddressLine1" type="nvarchar (60)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>First street address line.</Line></Comment></Comments></Field><Field name="AddressLine2" type="nvarchar (60)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Second street address line.</Line></Comment></Comments></Field><Field name="City" type="nvarchar (30)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Name of the city.</Line></Comment></Comments></Field><Field name="StateProvinceID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unique identification number for the state or province. Foreign key to StateProvince table.</Line></Comment></Comments></Field><Field name="PostalCode" type="nvarchar (15)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Postal code for the street address.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Address_AddressID" clustered="Yes" unique="Yes"><IndexFields><IndexField>AddressID</IndexField></IndexFields></Index><Index name="AK_Address_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode" clustered="No" unique="Yes"><IndexFields><IndexField>AddressLine1</IndexField><IndexField>AddressLine2</IndexField><IndexField>City</IndexField><IndexField>StateProvinceID</IndexField><IndexField>PostalCode</IndexField></IndexFields></Index><Index name="IX_Address_StateProvinceID" clustered="No" unique="No"><IndexFields><IndexField>StateProvinceID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_Address_StateProvince_StateProvinceID" affectedField="StateProvinceID" sourceTable="Person.StateProvince"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_CustomerAddress_Address_AddressID" affectedSchema="" affectedTable="Sales.CustomerAddress" affectedField="AddressID"/><ExternalForeignKey name="FK_EmployeeAddress_Address_AddressID" affectedSchema="" affectedTable="HumanResources.EmployeeAddress" affectedField="AddressID"/><ExternalForeignKey name="FK_SalesOrderHeader_Address_BillToAddressID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="BillToAddressID"/><ExternalForeignKey name="FK_SalesOrderHeader_Address_ShipToAddressID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="ShipToAddressID"/><ExternalForeignKey name="FK_VendorAddress_Address_AddressID" affectedSchema="" affectedTable="Purchasing.VendorAddress" affectedField="AddressID"/></ExternalForeignKeys><Triggers/></Table><Table name="Person.AddressType" file="AdventureWorks_201011112041_Person.AddressType.html"><Descriptions><Description type="" text="Types of addresses stored in the Address table. "/></Descriptions><PrimaryKeys><KeyField>AddressTypeID</KeyField></PrimaryKeys><Fields><Field name="AddressTypeID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for AddressType records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Address type description. For example, Billing, Home, or Shipping.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_AddressType_AddressTypeID" clustered="Yes" unique="Yes"><IndexFields><IndexField>AddressTypeID</IndexField></IndexFields></Index><Index name="AK_AddressType_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="AK_AddressType_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_CustomerAddress_AddressType_AddressTypeID" affectedSchema="" affectedTable="Sales.CustomerAddress" affectedField="AddressTypeID"/><ExternalForeignKey name="FK_VendorAddress_AddressType_AddressTypeID" affectedSchema="" affectedTable="Purchasing.VendorAddress" affectedField="AddressTypeID"/></ExternalForeignKeys><Triggers/></Table><Table name="Person.Contact" file="AdventureWorks_201011112041_Person.Contact.html"><Descriptions><Description type="" text="Names of each employee, customer contact, and vendor contact."/></Descriptions><PrimaryKeys><KeyField>ContactID</KeyField></PrimaryKeys><Fields><Field name="ContactID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Contact records.</Line></Comment></Comments></Field><Field name="NameStyle" type="bit" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>0 = The data in FirstName and LastName are stored in western style (first name, last name) order.  1 = Eastern style (last name, first name) order.</Line></Comment></Comments></Field><Field name="Title" type="nvarchar (8)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>A courtesy title. For example, Mr. or Ms.</Line></Comment></Comments></Field><Field name="FirstName" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>First name of the person.</Line></Comment></Comments></Field><Field name="MiddleName" type="nvarchar (50)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Middle name or middle initial of the person.</Line></Comment></Comments></Field><Field name="LastName" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Last name of the person.</Line></Comment></Comments></Field><Field name="Suffix" type="nvarchar (10)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Surname suffix. For example, Sr. or Jr.</Line></Comment></Comments></Field><Field name="EmailAddress" type="nvarchar (50)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>E-mail address for the person.</Line></Comment></Comments></Field><Field name="EmailPromotion" type="int" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>0 = Contact does not wish to receive e-mail promotions, 1 = Contact does wish to receive e-mail promotions from AdventureWorks, 2 = Contact does wish to receive e-mail promotions from AdventureWorks and selected partners. </Line></Comment></Comments></Field><Field name="Phone" type="nvarchar (25)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Phone number associated with the person.</Line></Comment></Comments></Field><Field name="PasswordHash" type="varchar (128)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Password for the e-mail account.</Line></Comment></Comments></Field><Field name="PasswordSalt" type="varchar (10)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Random value concatenated with the password string before the password is hashed.</Line></Comment></Comments></Field><Field name="AdditionalContactInfo" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Additional contact information about the person stored in xml format. </Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Contact_ContactID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ContactID</IndexField></IndexFields></Index><Index name="AK_Contact_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_Contact_EmailAddress" clustered="No" unique="No"><IndexFields><IndexField>EmailAddress</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Contact_EmailPromotion" text="([EmailPromotion]&gt;=(0) AND [EmailPromotion]&lt;=(2))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ContactCreditCard_Contact_ContactID" affectedSchema="" affectedTable="Sales.ContactCreditCard" affectedField="ContactID"/><ExternalForeignKey name="FK_Employee_Contact_ContactID" affectedSchema="" affectedTable="HumanResources.Employee" affectedField="ContactID"/><ExternalForeignKey name="FK_Individual_Contact_ContactID" affectedSchema="" affectedTable="Sales.Individual" affectedField="ContactID"/><ExternalForeignKey name="FK_SalesOrderHeader_Contact_ContactID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="ContactID"/><ExternalForeignKey name="FK_StoreContact_Contact_ContactID" affectedSchema="" affectedTable="Sales.StoreContact" affectedField="ContactID"/><ExternalForeignKey name="FK_VendorContact_Contact_ContactID" affectedSchema="" affectedTable="Purchasing.VendorContact" affectedField="ContactID"/></ExternalForeignKeys><Triggers/></Table><Table name="Person.ContactType" file="AdventureWorks_201011112041_Person.ContactType.html"><Descriptions><Description type="" text="Lookup table containing the types of contacts stored in Contact."/></Descriptions><PrimaryKeys><KeyField>ContactTypeID</KeyField></PrimaryKeys><Fields><Field name="ContactTypeID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ContactType records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Contact type description.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ContactType_ContactTypeID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ContactTypeID</IndexField></IndexFields></Index><Index name="AK_ContactType_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_StoreContact_ContactType_ContactTypeID" affectedSchema="" affectedTable="Sales.StoreContact" affectedField="ContactTypeID"/><ExternalForeignKey name="FK_VendorContact_ContactType_ContactTypeID" affectedSchema="" affectedTable="Purchasing.VendorContact" affectedField="ContactTypeID"/></ExternalForeignKeys><Triggers/></Table><Table name="Person.CountryRegion" file="AdventureWorks_201011112041_Person.CountryRegion.html"><Descriptions><Description type="" text="Lookup table containing the ISO standard codes for countries and regions."/></Descriptions><PrimaryKeys><KeyField>CountryRegionCode</KeyField></PrimaryKeys><Fields><Field name="CountryRegionCode" type="nvarchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ISO standard code for countries and regions.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Country or region name.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_CountryRegion_CountryRegionCode" clustered="Yes" unique="Yes"><IndexFields><IndexField>CountryRegionCode</IndexField></IndexFields></Index><Index name="AK_CountryRegion_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_CountryRegionCurrency_CountryRegion_CountryRegionCode" affectedSchema="" affectedTable="Sales.CountryRegionCurrency" affectedField="CountryRegionCode"/><ExternalForeignKey name="FK_StateProvince_CountryRegion_CountryRegionCode" affectedSchema="" affectedTable="Person.StateProvince" affectedField="CountryRegionCode"/></ExternalForeignKeys><Triggers/></Table><Table name="Person.StateProvince" file="AdventureWorks_201011112041_Person.StateProvince.html"><Descriptions><Description type="" text="State and province lookup table."/></Descriptions><PrimaryKeys><KeyField>StateProvinceID</KeyField></PrimaryKeys><Fields><Field name="StateProvinceID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for StateProvince records.</Line></Comment></Comments></Field><Field name="StateProvinceCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ISO standard state or province code.</Line></Comment></Comments></Field><Field name="CountryRegionCode" type="nvarchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. </Line></Comment></Comments></Field><Field name="IsOnlyStateProvinceFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = StateProvinceCode exists. 1 = StateProvinceCode unavailable, using CountryRegionCode.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>State or province description.</Line></Comment></Comments></Field><Field name="TerritoryID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ID of the territory in which the state or province is located. Foreign key to SalesTerritory.SalesTerritoryID.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_StateProvince_StateProvinceID" clustered="Yes" unique="Yes"><IndexFields><IndexField>StateProvinceID</IndexField></IndexFields></Index><Index name="AK_StateProvince_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_StateProvince_StateProvinceCode_CountryRegionCode" clustered="No" unique="Yes"><IndexFields><IndexField>StateProvinceCode</IndexField><IndexField>CountryRegionCode</IndexField></IndexFields></Index><Index name="AK_StateProvince_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_StateProvince_CountryRegion_CountryRegionCode" affectedField="CountryRegionCode" sourceTable="Person.CountryRegion"/><InternalForeignKey name="FK_StateProvince_SalesTerritory_TerritoryID" affectedField="TerritoryID" sourceTable="Sales.SalesTerritory"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_Address_StateProvince_StateProvinceID" affectedSchema="" affectedTable="Person.Address" affectedField="StateProvinceID"/><ExternalForeignKey name="FK_SalesTaxRate_StateProvince_StateProvinceID" affectedSchema="" affectedTable="Sales.SalesTaxRate" affectedField="StateProvinceID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.BillOfMaterials" file="AdventureWorks_201011112041_Production.BillOfMaterials.html"><Descriptions><Description type="" text="Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components."/></Descriptions><PrimaryKeys><KeyField>BillOfMaterialsID</KeyField></PrimaryKeys><Fields><Field name="BillOfMaterialsID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for BillOfMaterials records.</Line></Comment></Comments></Field><Field name="ProductAssemblyID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Parent product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="ComponentID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Component identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date the component started being used in the assembly item.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the component stopped being used in the assembly item.</Line></Comment></Comments></Field><Field name="UnitMeasureCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Standard code identifying the unit of measure for the quantity.</Line></Comment></Comments></Field><Field name="BOMLevel" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Indicates the depth the component is from its parent (AssemblyID).</Line></Comment></Comments></Field><Field name="PerAssemblyQty" type="decimal (8, 2)" defaults="((1.00))" nullable="No"><Comments><Comment type="Description"><Line>Quantity of the component needed to create the assembly.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductAssemblyID</IndexField><IndexField>ComponentID</IndexField><IndexField>StartDate</IndexField></IndexFields></Index><Index name="PK_BillOfMaterials_BillOfMaterialsID" clustered="No" unique="Yes"><IndexFields><IndexField>BillOfMaterialsID</IndexField></IndexFields></Index><Index name="IX_BillOfMaterials_UnitMeasureCode" clustered="No" unique="No"><IndexFields><IndexField>UnitMeasureCode</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_BillOfMaterials_EndDate" text="([EndDate]&gt;[StartDate] OR [EndDate] IS NULL)"/><CheckConstraint name="CK_BillOfMaterials_ProductAssemblyID" text="([ProductAssemblyID]&lt;&gt;[ComponentID])"/><CheckConstraint name="CK_BillOfMaterials_BOMLevel" text="([ProductAssemblyID] IS NULL AND [BOMLevel]=(0) AND [PerAssemblyQty]=(1.00) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel]&gt;=(1))"/><CheckConstraint name="CK_BillOfMaterials_PerAssemblyQty" text="([PerAssemblyQty]&gt;=(1.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_BillOfMaterials_Product_ComponentID" affectedField="ComponentID" sourceTable="Production.Product"/><InternalForeignKey name="FK_BillOfMaterials_Product_ProductAssemblyID" affectedField="ProductAssemblyID" sourceTable="Production.Product"/><InternalForeignKey name="FK_BillOfMaterials_UnitMeasure_UnitMeasureCode" affectedField="UnitMeasureCode" sourceTable="Production.UnitMeasure"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.Culture" file="AdventureWorks_201011112041_Production.Culture.html"><Descriptions><Description type="" text="Lookup table containing the languages in which some AdventureWorks data is stored."/></Descriptions><PrimaryKeys><KeyField>CultureID</KeyField></PrimaryKeys><Fields><Field name="CultureID" type="nchar (6)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Culture records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Culture description.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Culture_CultureID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CultureID</IndexField></IndexFields></Index><Index name="AK_Culture_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductModelProductDescriptionCulture_Culture_CultureID" affectedSchema="" affectedTable="Production.ProductModelProductDescriptionCulture" affectedField="CultureID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.Document" file="AdventureWorks_201011112041_Production.Document.html"><Descriptions><Description type="" text="Product maintenance documents."/></Descriptions><PrimaryKeys><KeyField>DocumentID</KeyField></PrimaryKeys><Fields><Field name="DocumentID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Document records.</Line></Comment></Comments></Field><Field name="Title" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Title of the document.</Line></Comment></Comments></Field><Field name="FileName" type="nvarchar (400)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Directory path and file name of the document</Line></Comment></Comments></Field><Field name="FileExtension" type="nvarchar (8)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>File extension indicating the document type. For example, .doc or .txt.</Line></Comment></Comments></Field><Field name="Revision" type="nchar (5)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Revision number of the document. </Line></Comment></Comments></Field><Field name="ChangeNumber" type="int" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Engineering change approval number.</Line></Comment></Comments></Field><Field name="Status" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>1 = Pending approval, 2 = Approved, 3 = Obsolete</Line></Comment></Comments></Field><Field name="DocumentSummary" type="nvarchar (MAX)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Document abstract.</Line></Comment></Comments></Field><Field name="Document" type="varbinary (MAX)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Complete document.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Document_DocumentID" clustered="Yes" unique="Yes"><IndexFields><IndexField>DocumentID</IndexField></IndexFields></Index><Index name="AK_Document_FileName_Revision" clustered="No" unique="Yes"><IndexFields><IndexField>FileName</IndexField><IndexField>Revision</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Document_Status" text="([Status]&gt;=(1) AND [Status]&lt;=(3))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductDocument_Document_DocumentID" affectedSchema="" affectedTable="Production.ProductDocument" affectedField="DocumentID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.Illustration" file="AdventureWorks_201011112041_Production.Illustration.html"><Descriptions><Description type="" text="Bicycle assembly diagrams."/></Descriptions><PrimaryKeys><KeyField>IllustrationID</KeyField></PrimaryKeys><Fields><Field name="IllustrationID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Illustration records.</Line></Comment></Comments></Field><Field name="Diagram" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Illustrations used in manufacturing instructions. Stored as XML.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Illustration_IllustrationID" clustered="Yes" unique="Yes"><IndexFields><IndexField>IllustrationID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductModelIllustration_Illustration_IllustrationID" affectedSchema="" affectedTable="Production.ProductModelIllustration" affectedField="IllustrationID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.Location" file="AdventureWorks_201011112041_Production.Location.html"><Descriptions><Description type="" text="Product inventory and manufacturing locations."/></Descriptions><PrimaryKeys><KeyField>LocationID</KeyField></PrimaryKeys><Fields><Field name="LocationID" type="smallint - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Location records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Location description.</Line></Comment></Comments></Field><Field name="CostRate" type="smallmoney" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Standard hourly cost of the manufacturing location.</Line></Comment></Comments></Field><Field name="Availability" type="decimal (8, 2)" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Work capacity (in hours) of the manufacturing location.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Location_LocationID" clustered="Yes" unique="Yes"><IndexFields><IndexField>LocationID</IndexField></IndexFields></Index><Index name="AK_Location_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Location_CostRate" text="([CostRate]&gt;=(0.00))"/><CheckConstraint name="CK_Location_Availability" text="([Availability]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductInventory_Location_LocationID" affectedSchema="" affectedTable="Production.ProductInventory" affectedField="LocationID"/><ExternalForeignKey name="FK_WorkOrderRouting_Location_LocationID" affectedSchema="" affectedTable="Production.WorkOrderRouting" affectedField="LocationID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.Product" file="AdventureWorks_201011112041_Production.Product.html"><Descriptions><Description type="" text="Products sold or used in the manfacturing of sold products."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Product records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Name of the product.</Line></Comment></Comments></Field><Field name="ProductNumber" type="nvarchar (25)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unique product identification number.</Line></Comment></Comments></Field><Field name="MakeFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = Product is purchased, 1 = Product is manufactured in-house.</Line></Comment></Comments></Field><Field name="FinishedGoodsFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = Product is not a salable item. 1 = Product is salable.</Line></Comment></Comments></Field><Field name="Color" type="nvarchar (15)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Product color.</Line></Comment></Comments></Field><Field name="SafetyStockLevel" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Minimum inventory quantity. </Line></Comment></Comments></Field><Field name="ReorderPoint" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Inventory level that triggers a purchase order or work order. </Line></Comment></Comments></Field><Field name="StandardCost" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Standard cost of the product.</Line></Comment></Comments></Field><Field name="ListPrice" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Selling price.</Line></Comment></Comments></Field><Field name="Size" type="nvarchar (5)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Product size.</Line></Comment></Comments></Field><Field name="SizeUnitMeasureCode" type="nchar (3)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Unit of measure for Size column.</Line></Comment></Comments></Field><Field name="WeightUnitMeasureCode" type="nchar (3)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Unit of measure for Weight column.</Line></Comment></Comments></Field><Field name="Weight" type="decimal (8, 2)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Product weight.</Line></Comment></Comments></Field><Field name="DaysToManufacture" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Number of days required to manufacture the product.</Line></Comment></Comments></Field><Field name="ProductLine" type="nchar (2)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>R = Road, M = Mountain, T = Touring, S = Standard</Line></Comment></Comments></Field><Field name="Class" type="nchar (2)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>H = High, M = Medium, L = Low</Line></Comment></Comments></Field><Field name="Style" type="nchar (2)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>W = Womens, M = Mens, U = Universal</Line></Comment></Comments></Field><Field name="ProductSubcategoryID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Product is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID. </Line></Comment></Comments></Field><Field name="ProductModelID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Product is a member of this product model. Foreign key to ProductModel.ProductModelID.</Line></Comment></Comments></Field><Field name="SellStartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date the product was available for sale.</Line></Comment></Comments></Field><Field name="SellEndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the product was no longer available for sale.</Line></Comment></Comments></Field><Field name="DiscontinuedDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the product was discontinued.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Product_ProductID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index><Index name="AK_Product_ProductNumber" clustered="No" unique="Yes"><IndexFields><IndexField>ProductNumber</IndexField></IndexFields></Index><Index name="AK_Product_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_Product_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Product_SafetyStockLevel" text="([SafetyStockLevel]&gt;(0))"/><CheckConstraint name="CK_Product_ReorderPoint" text="([ReorderPoint]&gt;(0))"/><CheckConstraint name="CK_Product_StandardCost" text="([StandardCost]&gt;=(0.00))"/><CheckConstraint name="CK_Product_ListPrice" text="([ListPrice]&gt;=(0.00))"/><CheckConstraint name="CK_Product_Weight" text="([Weight]&gt;(0.00))"/><CheckConstraint name="CK_Product_DaysToManufacture" text="([DaysToManufacture]&gt;=(0))"/><CheckConstraint name="CK_Product_ProductLine" text="(upper([ProductLine])='R' OR upper([ProductLine])='M' OR upper([ProductLine])='T' OR upper([ProductLine])='S' OR [ProductLine] IS NULL)"/><CheckConstraint name="CK_Product_Class" text="(upper([Class])='H' OR upper([Class])='M' OR upper([Class])='L' OR [Class] IS NULL)"/><CheckConstraint name="CK_Product_Style" text="(upper([Style])='U' OR upper([Style])='M' OR upper([Style])='W' OR [Style] IS NULL)"/><CheckConstraint name="CK_Product_SellEndDate" text="([SellEndDate]&gt;=[SellStartDate] OR [SellEndDate] IS NULL)"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_Product_ProductModel_ProductModelID" affectedField="ProductModelID" sourceTable="Production.ProductModel"/><InternalForeignKey name="FK_Product_ProductSubcategory_ProductSubcategoryID" affectedField="ProductSubcategoryID" sourceTable="Production.ProductSubcategory"/><InternalForeignKey name="FK_Product_UnitMeasure_SizeUnitMeasureCode" affectedField="SizeUnitMeasureCode" sourceTable="Production.UnitMeasure"/><InternalForeignKey name="FK_Product_UnitMeasure_WeightUnitMeasureCode" affectedField="WeightUnitMeasureCode" sourceTable="Production.UnitMeasure"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_BillOfMaterials_Product_ComponentID" affectedSchema="" affectedTable="Production.BillOfMaterials" affectedField="ComponentID"/><ExternalForeignKey name="FK_BillOfMaterials_Product_ProductAssemblyID" affectedSchema="" affectedTable="Production.BillOfMaterials" affectedField="ProductAssemblyID"/><ExternalForeignKey name="FK_ProductCostHistory_Product_ProductID" affectedSchema="" affectedTable="Production.ProductCostHistory" affectedField="ProductID"/><ExternalForeignKey name="FK_ProductDocument_Product_ProductID" affectedSchema="" affectedTable="Production.ProductDocument" affectedField="ProductID"/><ExternalForeignKey name="FK_ProductInventory_Product_ProductID" affectedSchema="" affectedTable="Production.ProductInventory" affectedField="ProductID"/><ExternalForeignKey name="FK_ProductListPriceHistory_Product_ProductID" affectedSchema="" affectedTable="Production.ProductListPriceHistory" affectedField="ProductID"/><ExternalForeignKey name="FK_ProductProductPhoto_Product_ProductID" affectedSchema="" affectedTable="Production.ProductProductPhoto" affectedField="ProductID"/><ExternalForeignKey name="FK_ProductReview_Product_ProductID" affectedSchema="" affectedTable="Production.ProductReview" affectedField="ProductID"/><ExternalForeignKey name="FK_ProductVendor_Product_ProductID" affectedSchema="" affectedTable="Purchasing.ProductVendor" affectedField="ProductID"/><ExternalForeignKey name="FK_PurchaseOrderDetail_Product_ProductID" affectedSchema="" affectedTable="Purchasing.PurchaseOrderDetail" affectedField="ProductID"/><ExternalForeignKey name="FK_ShoppingCartItem_Product_ProductID" affectedSchema="" affectedTable="Sales.ShoppingCartItem" affectedField="ProductID"/><ExternalForeignKey name="FK_SpecialOfferProduct_Product_ProductID" affectedSchema="" affectedTable="Sales.SpecialOfferProduct" affectedField="ProductID"/><ExternalForeignKey name="FK_TransactionHistory_Product_ProductID" affectedSchema="" affectedTable="Production.TransactionHistory" affectedField="ProductID"/><ExternalForeignKey name="FK_WorkOrder_Product_ProductID" affectedSchema="" affectedTable="Production.WorkOrder" affectedField="ProductID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.ProductCategory" file="AdventureWorks_201011112041_Production.ProductCategory.html"><Descriptions><Description type="" text="High-level product categorization."/></Descriptions><PrimaryKeys><KeyField>ProductCategoryID</KeyField></PrimaryKeys><Fields><Field name="ProductCategoryID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ProductCategory records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Category description.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductCategory_ProductCategoryID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductCategoryID</IndexField></IndexFields></Index><Index name="AK_ProductCategory_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_ProductCategory_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductSubcategory_ProductCategory_ProductCategoryID" affectedSchema="" affectedTable="Production.ProductSubcategory" affectedField="ProductCategoryID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.ProductCostHistory" file="AdventureWorks_201011112041_Production.ProductCostHistory.html"><Descriptions><Description type="" text="Changes in the cost of a product over time."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField><KeyField>StartDate</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product cost start date.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Product cost end date.</Line></Comment></Comments></Field><Field name="StandardCost" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Standard cost of the product.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductCostHistory_ProductID_StartDate" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductID</IndexField><IndexField>StartDate</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ProductCostHistory_EndDate" text="([EndDate]&gt;=[StartDate] OR [EndDate] IS NULL)"/><CheckConstraint name="CK_ProductCostHistory_StandardCost" text="([StandardCost]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_ProductCostHistory_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductDescription" file="AdventureWorks_201011112041_Production.ProductDescription.html"><Descriptions><Description type="" text="Product descriptions in several languages."/></Descriptions><PrimaryKeys><KeyField>ProductDescriptionID</KeyField></PrimaryKeys><Fields><Field name="ProductDescriptionID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ProductDescription records.</Line></Comment></Comments></Field><Field name="Description" type="nvarchar (400)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Description of the product.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductDescription_ProductDescriptionID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductDescriptionID</IndexField></IndexFields></Index><Index name="AK_ProductDescription_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID" affectedSchema="" affectedTable="Production.ProductModelProductDescriptionCulture" affectedField="ProductDescriptionID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.ProductDocument" file="AdventureWorks_201011112041_Production.ProductDocument.html"><Descriptions><Description type="" text="Cross-reference table mapping products to related product documents."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField><KeyField>DocumentID</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="DocumentID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Document identification number. Foreign key to Document.DocumentID.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductDocument_ProductID_DocumentID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductID</IndexField><IndexField>DocumentID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_ProductDocument_Document_DocumentID" affectedField="DocumentID" sourceTable="Production.Document"/><InternalForeignKey name="FK_ProductDocument_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductInventory" file="AdventureWorks_201011112041_Production.ProductInventory.html"><Descriptions><Description type="" text="Product inventory information."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField><KeyField>LocationID</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="LocationID" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Inventory location identification number. Foreign key to Location.LocationID. </Line></Comment></Comments></Field><Field name="Shelf" type="nvarchar (10)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Storage compartment within an inventory location.</Line></Comment></Comments></Field><Field name="Bin" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Storage container on a shelf in an inventory location.</Line></Comment></Comments></Field><Field name="Quantity" type="smallint" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Quantity of products in the inventory location.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductInventory_ProductID_LocationID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductID</IndexField><IndexField>LocationID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ProductInventory_Shelf" text="([Shelf] like '[A-Za-z]' OR [Shelf]='N/A')"/><CheckConstraint name="CK_ProductInventory_Bin" text="([Bin]&gt;=(0) AND [Bin]&lt;=(100))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_ProductInventory_Location_LocationID" affectedField="LocationID" sourceTable="Production.Location"/><InternalForeignKey name="FK_ProductInventory_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductListPriceHistory" file="AdventureWorks_201011112041_Production.ProductListPriceHistory.html"><Descriptions><Description type="" text="Changes in the list price of a product over time."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField><KeyField>StartDate</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>List price start date.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>List price end date</Line></Comment></Comments></Field><Field name="ListPrice" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product list price.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductListPriceHistory_ProductID_StartDate" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductID</IndexField><IndexField>StartDate</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ProductListPriceHistory_EndDate" text="([EndDate]&gt;=[StartDate] OR [EndDate] IS NULL)"/><CheckConstraint name="CK_ProductListPriceHistory_ListPrice" text="([ListPrice]&gt;(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_ProductListPriceHistory_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductModel" file="AdventureWorks_201011112041_Production.ProductModel.html"><Descriptions><Description type="" text="Product model classification."/></Descriptions><PrimaryKeys><KeyField>ProductModelID</KeyField></PrimaryKeys><Fields><Field name="ProductModelID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ProductModel records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product model description.</Line></Comment></Comments></Field><Field name="CatalogDescription" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Detailed product catalog information in xml format.</Line></Comment></Comments></Field><Field name="Instructions" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Manufacturing instructions in xml format.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductModel_ProductModelID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductModelID</IndexField></IndexFields></Index><Index name="AK_ProductModel_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_ProductModel_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_Product_ProductModel_ProductModelID" affectedSchema="" affectedTable="Production.Product" affectedField="ProductModelID"/><ExternalForeignKey name="FK_ProductModelIllustration_ProductModel_ProductModelID" affectedSchema="" affectedTable="Production.ProductModelIllustration" affectedField="ProductModelID"/><ExternalForeignKey name="FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID" affectedSchema="" affectedTable="Production.ProductModelProductDescriptionCulture" affectedField="ProductModelID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.ProductModelIllustration" file="AdventureWorks_201011112041_Production.ProductModelIllustration.html"><Descriptions><Description type="" text="Cross-reference table mapping product models and illustrations."/></Descriptions><PrimaryKeys><KeyField>ProductModelID</KeyField><KeyField>IllustrationID</KeyField></PrimaryKeys><Fields><Field name="ProductModelID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to ProductModel.ProductModelID.</Line></Comment></Comments></Field><Field name="IllustrationID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Illustration.IllustrationID.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductModelIllustration_ProductModelID_IllustrationID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductModelID</IndexField><IndexField>IllustrationID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_ProductModelIllustration_Illustration_IllustrationID" affectedField="IllustrationID" sourceTable="Production.Illustration"/><InternalForeignKey name="FK_ProductModelIllustration_ProductModel_ProductModelID" affectedField="ProductModelID" sourceTable="Production.ProductModel"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductModelProductDescriptionCulture" file="AdventureWorks_201011112041_Production.ProductModelProductDescriptionCulture.html"><Descriptions><Description type="" text="Cross-reference table mapping product descriptions and the language the description is written in."/></Descriptions><PrimaryKeys><KeyField>ProductModelID</KeyField><KeyField>ProductDescriptionID</KeyField><KeyField>CultureID</KeyField></PrimaryKeys><Fields><Field name="ProductModelID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to ProductModel.ProductModelID.</Line></Comment></Comments></Field><Field name="ProductDescriptionID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to ProductDescription.ProductDescriptionID.</Line></Comment></Comments></Field><Field name="CultureID" type="nchar (6)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Culture identification number. Foreign key to Culture.CultureID.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductModelID</IndexField><IndexField>ProductDescriptionID</IndexField><IndexField>CultureID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_ProductModelProductDescriptionCulture_Culture_CultureID" affectedField="CultureID" sourceTable="Production.Culture"/><InternalForeignKey name="FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID" affectedField="ProductDescriptionID" sourceTable="Production.ProductDescription"/><InternalForeignKey name="FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID" affectedField="ProductModelID" sourceTable="Production.ProductModel"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductPhoto" file="AdventureWorks_201011112041_Production.ProductPhoto.html"><Descriptions><Description type="" text="Product images."/></Descriptions><PrimaryKeys><KeyField>ProductPhotoID</KeyField></PrimaryKeys><Fields><Field name="ProductPhotoID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ProductPhoto records.</Line></Comment></Comments></Field><Field name="ThumbNailPhoto" type="varbinary (MAX)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Small image of the product.</Line></Comment></Comments></Field><Field name="ThumbnailPhotoFileName" type="nvarchar (50)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Small image file name.</Line></Comment></Comments></Field><Field name="LargePhoto" type="varbinary (MAX)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Large image of the product.</Line></Comment></Comments></Field><Field name="LargePhotoFileName" type="nvarchar (50)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Large image file name.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductPhoto_ProductPhotoID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductPhotoID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductProductPhoto_ProductPhoto_ProductPhotoID" affectedSchema="" affectedTable="Production.ProductProductPhoto" affectedField="ProductPhotoID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.ProductProductPhoto" file="AdventureWorks_201011112041_Production.ProductProductPhoto.html"><Descriptions><Description type="" text="Cross-reference table mapping products and product photos."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField><KeyField>ProductPhotoID</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="ProductPhotoID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.</Line></Comment></Comments></Field><Field name="Primary" type="bit" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>0 = Photo is not the principal image. 1 = Photo is the principal image.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductProductPhoto_ProductID_ProductPhotoID" clustered="No" unique="Yes"><IndexFields><IndexField>ProductID</IndexField><IndexField>ProductPhotoID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_ProductProductPhoto_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/><InternalForeignKey name="FK_ProductProductPhoto_ProductPhoto_ProductPhotoID" affectedField="ProductPhotoID" sourceTable="Production.ProductPhoto"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductReview" file="AdventureWorks_201011112041_Production.ProductReview.html"><Descriptions><Description type="" text="Customer reviews of products they have purchased."/></Descriptions><PrimaryKeys><KeyField>ProductReviewID</KeyField></PrimaryKeys><Fields><Field name="ProductReviewID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ProductReview records.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="ReviewerName" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Name of the reviewer.</Line></Comment></Comments></Field><Field name="ReviewDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date review was submitted.</Line></Comment></Comments></Field><Field name="EmailAddress" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Reviewer's e-mail address.</Line></Comment></Comments></Field><Field name="Rating" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating.</Line></Comment></Comments></Field><Field name="Comments" type="nvarchar (3850)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Reviewer's comments</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductReview_ProductReviewID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductReviewID</IndexField></IndexFields></Index><Index name="IX_ProductReview_ProductID_Name" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField><IndexField>ReviewerName</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ProductReview_Rating" text="([Rating]&gt;=(1) AND [Rating]&lt;=(5))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_ProductReview_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.ProductSubcategory" file="AdventureWorks_201011112041_Production.ProductSubcategory.html"><Descriptions><Description type="" text="Product subcategories. See ProductCategory table."/></Descriptions><PrimaryKeys><KeyField>ProductSubcategoryID</KeyField></PrimaryKeys><Fields><Field name="ProductSubcategoryID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ProductSubcategory records.</Line></Comment></Comments></Field><Field name="ProductCategoryID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product category identification number. Foreign key to ProductCategory.ProductCategoryID.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Subcategory description.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductSubcategory_ProductSubcategoryID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductSubcategoryID</IndexField></IndexFields></Index><Index name="AK_ProductSubcategory_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_ProductSubcategory_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_ProductSubcategory_ProductCategory_ProductCategoryID" affectedField="ProductCategoryID" sourceTable="Production.ProductCategory"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_Product_ProductSubcategory_ProductSubcategoryID" affectedSchema="" affectedTable="Production.Product" affectedField="ProductSubcategoryID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.ScrapReason" file="AdventureWorks_201011112041_Production.ScrapReason.html"><Descriptions><Description type="" text="Manufacturing failure reasons lookup table."/></Descriptions><PrimaryKeys><KeyField>ScrapReasonID</KeyField></PrimaryKeys><Fields><Field name="ScrapReasonID" type="smallint - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ScrapReason records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Failure description.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ScrapReason_ScrapReasonID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ScrapReasonID</IndexField></IndexFields></Index><Index name="AK_ScrapReason_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_WorkOrder_ScrapReason_ScrapReasonID" affectedSchema="" affectedTable="Production.WorkOrder" affectedField="ScrapReasonID"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.TransactionHistory" file="AdventureWorks_201011112041_Production.TransactionHistory.html"><Descriptions><Description type="" text="Record of each purchase order, sales order, or work order transaction year to date."/></Descriptions><PrimaryKeys><KeyField>TransactionID</KeyField></PrimaryKeys><Fields><Field name="TransactionID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for TransactionHistory records.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="ReferenceOrderID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Purchase order, sales order, or work order identification number.</Line></Comment></Comments></Field><Field name="ReferenceOrderLineID" type="int" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Line number associated with the purchase order, sales order, or work order.</Line></Comment></Comments></Field><Field name="TransactionDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time of the transaction.</Line></Comment></Comments></Field><Field name="TransactionType" type="nchar (1)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>W = WorkOrder, S = SalesOrder, P = PurchaseOrder</Line></Comment></Comments></Field><Field name="Quantity" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product quantity.</Line></Comment></Comments></Field><Field name="ActualCost" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product cost.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_TransactionHistory_TransactionID" clustered="Yes" unique="Yes"><IndexFields><IndexField>TransactionID</IndexField></IndexFields></Index><Index name="IX_TransactionHistory_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index><Index name="IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID" clustered="No" unique="No"><IndexFields><IndexField>ReferenceOrderID</IndexField><IndexField>ReferenceOrderLineID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_TransactionHistory_TransactionType" text="(upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W')"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_TransactionHistory_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Production.TransactionHistoryArchive" file="AdventureWorks_201011112041_Production.TransactionHistoryArchive.html"><Descriptions><Description type="" text="Transactions for previous years."/></Descriptions><PrimaryKeys><KeyField>TransactionID</KeyField></PrimaryKeys><Fields><Field name="TransactionID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for TransactionHistoryArchive records.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="ReferenceOrderID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Purchase order, sales order, or work order identification number.</Line></Comment></Comments></Field><Field name="ReferenceOrderLineID" type="int" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Line number associated with the purchase order, sales order, or work order.</Line></Comment></Comments></Field><Field name="TransactionDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time of the transaction.</Line></Comment></Comments></Field><Field name="TransactionType" type="nchar (1)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>W = Work Order, S = Sales Order, P = Purchase Order</Line></Comment></Comments></Field><Field name="Quantity" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product quantity.</Line></Comment></Comments></Field><Field name="ActualCost" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product cost.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_TransactionHistoryArchive_TransactionID" clustered="Yes" unique="Yes"><IndexFields><IndexField>TransactionID</IndexField></IndexFields></Index><Index name="IX_TransactionHistoryArchive_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index><Index name="IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID" clustered="No" unique="No"><IndexFields><IndexField>ReferenceOrderID</IndexField><IndexField>ReferenceOrderLineID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_TransactionHistoryArchive_TransactionType" text="(upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W')"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys/><Triggers/></Table><Table name="Production.UnitMeasure" file="AdventureWorks_201011112041_Production.UnitMeasure.html"><Descriptions><Description type="" text="Unit of measure lookup table."/></Descriptions><PrimaryKeys><KeyField>UnitMeasureCode</KeyField></PrimaryKeys><Fields><Field name="UnitMeasureCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unit of measure description.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_UnitMeasure_UnitMeasureCode" clustered="Yes" unique="Yes"><IndexFields><IndexField>UnitMeasureCode</IndexField></IndexFields></Index><Index name="AK_UnitMeasure_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_BillOfMaterials_UnitMeasure_UnitMeasureCode" affectedSchema="" affectedTable="Production.BillOfMaterials" affectedField="UnitMeasureCode"/><ExternalForeignKey name="FK_Product_UnitMeasure_SizeUnitMeasureCode" affectedSchema="" affectedTable="Production.Product" affectedField="SizeUnitMeasureCode"/><ExternalForeignKey name="FK_Product_UnitMeasure_WeightUnitMeasureCode" affectedSchema="" affectedTable="Production.Product" affectedField="WeightUnitMeasureCode"/><ExternalForeignKey name="FK_ProductVendor_UnitMeasure_UnitMeasureCode" affectedSchema="" affectedTable="Purchasing.ProductVendor" affectedField="UnitMeasureCode"/></ExternalForeignKeys><Triggers/></Table><Table name="Production.WorkOrder" file="AdventureWorks_201011112041_Production.WorkOrder.html"><Descriptions><Description type="" text="Manufacturing work orders."/></Descriptions><PrimaryKeys><KeyField>WorkOrderID</KeyField></PrimaryKeys><Fields><Field name="WorkOrderID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for WorkOrder records.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="OrderQty" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product quantity to build.</Line></Comment></Comments></Field><Field name="StockedQty" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity built and put in inventory.</Line></Comment></Comments></Field><Field name="ScrappedQty" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity that failed inspection.</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Work order start date.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Work order end date.</Line></Comment></Comments></Field><Field name="DueDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Work order due date.</Line></Comment></Comments></Field><Field name="ScrapReasonID" type="smallint" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Reason for inspection failure.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_WorkOrder_WorkOrderID" clustered="Yes" unique="Yes"><IndexFields><IndexField>WorkOrderID</IndexField></IndexFields></Index><Index name="IX_WorkOrder_ScrapReasonID" clustered="No" unique="No"><IndexFields><IndexField>ScrapReasonID</IndexField></IndexFields></Index><Index name="IX_WorkOrder_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_WorkOrder_OrderQty" text="([OrderQty]&gt;(0))"/><CheckConstraint name="CK_WorkOrder_ScrappedQty" text="([ScrappedQty]&gt;=(0))"/><CheckConstraint name="CK_WorkOrder_EndDate" text="([EndDate]&gt;=[StartDate] OR [EndDate] IS NULL)"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_WorkOrder_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/><InternalForeignKey name="FK_WorkOrder_ScrapReason_ScrapReasonID" affectedField="ScrapReasonID" sourceTable="Production.ScrapReason"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_WorkOrderRouting_WorkOrder_WorkOrderID" affectedSchema="" affectedTable="Production.WorkOrderRouting" affectedField="WorkOrderID"/></ExternalForeignKeys><Triggers><Trigger name="iWorkOrder"><Text><Line text="CREATE TRIGGER [Production].[iWorkOrder] ON [Production].[WorkOrder] "/><Line text="AFTER INSERT AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="INSERT INTO [Production].[TransactionHistory]("/><Line text="[ProductID]"/><Line text=",[ReferenceOrderID]"/><Line text=",[TransactionType]"/><Line text=",[TransactionDate]"/><Line text=",[Quantity]"/><Line text=",[ActualCost])"/><Line text="SELECT "/><Line text="inserted.[ProductID]"/><Line text=",inserted.[WorkOrderID]"/><Line text=",'W'"/><Line text=",GETDATE()"/><Line text=",inserted.[OrderQty]"/><Line text=",0"/><Line text="FROM inserted;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger><Trigger name="uWorkOrder"><Text><Line text="CREATE TRIGGER [Production].[uWorkOrder] ON [Production].[WorkOrder] "/><Line text="AFTER UPDATE AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="IF UPDATE([ProductID]) OR UPDATE([OrderQty])"/><Line text="BEGIN"/><Line text="INSERT INTO [Production].[TransactionHistory]("/><Line text="[ProductID]"/><Line text=",[ReferenceOrderID]"/><Line text=",[TransactionType]"/><Line text=",[TransactionDate]"/><Line text=",[Quantity])"/><Line text="SELECT "/><Line text="inserted.[ProductID]"/><Line text=",inserted.[WorkOrderID]"/><Line text=",'W'"/><Line text=",GETDATE()"/><Line text=",inserted.[OrderQty]"/><Line text="FROM inserted;"/><Line text="END;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Production.WorkOrderRouting" file="AdventureWorks_201011112041_Production.WorkOrderRouting.html"><Descriptions><Description type="" text="Work order details."/></Descriptions><PrimaryKeys><KeyField>WorkOrderID</KeyField><KeyField>ProductID</KeyField><KeyField>OperationSequence</KeyField></PrimaryKeys><Fields><Field name="WorkOrderID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to WorkOrder.WorkOrderID.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="OperationSequence" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Indicates the manufacturing process sequence.</Line></Comment></Comments></Field><Field name="LocationID" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Manufacturing location where the part is processed. Foreign key to Location.LocationID.</Line></Comment></Comments></Field><Field name="ScheduledStartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Planned manufacturing start date.</Line></Comment></Comments></Field><Field name="ScheduledEndDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Planned manufacturing end date.</Line></Comment></Comments></Field><Field name="ActualStartDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Actual start date.</Line></Comment></Comments></Field><Field name="ActualEndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Actual end date.</Line></Comment></Comments></Field><Field name="ActualResourceHrs" type="decimal (9, 4)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Number of manufacturing hours used.</Line></Comment></Comments></Field><Field name="PlannedCost" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Estimated manufacturing cost.</Line></Comment></Comments></Field><Field name="ActualCost" type="money" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Actual manufacturing cost.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence" clustered="Yes" unique="Yes"><IndexFields><IndexField>WorkOrderID</IndexField><IndexField>ProductID</IndexField><IndexField>OperationSequence</IndexField></IndexFields></Index><Index name="IX_WorkOrderRouting_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_WorkOrderRouting_ScheduledEndDate" text="([ScheduledEndDate]&gt;=[ScheduledStartDate])"/><CheckConstraint name="CK_WorkOrderRouting_ActualEndDate" text="([ActualEndDate]&gt;=[ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL)"/><CheckConstraint name="CK_WorkOrderRouting_ActualResourceHrs" text="([ActualResourceHrs]&gt;=(0.0000))"/><CheckConstraint name="CK_WorkOrderRouting_PlannedCost" text="([PlannedCost]&gt;(0.00))"/><CheckConstraint name="CK_WorkOrderRouting_ActualCost" text="([ActualCost]&gt;(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_WorkOrderRouting_Location_LocationID" affectedField="LocationID" sourceTable="Production.Location"/><InternalForeignKey name="FK_WorkOrderRouting_WorkOrder_WorkOrderID" affectedField="WorkOrderID" sourceTable="Production.WorkOrder"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Purchasing.ProductVendor" file="AdventureWorks_201011112041_Purchasing.ProductVendor.html"><Descriptions><Description type="" text="Cross-reference table mapping vendors with the products they supply."/></Descriptions><PrimaryKeys><KeyField>ProductID</KeyField><KeyField>VendorID</KeyField></PrimaryKeys><Fields><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="VendorID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Vendor.VendorID.</Line></Comment></Comments></Field><Field name="AverageLeadTime" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The average span of time (in days) between placing an order with the vendor and receiving the purchased product.</Line></Comment></Comments></Field><Field name="StandardPrice" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The vendor's usual selling price.</Line></Comment></Comments></Field><Field name="LastReceiptCost" type="money" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The selling price when last purchased.</Line></Comment></Comments></Field><Field name="LastReceiptDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the product was last received by the vendor.</Line></Comment></Comments></Field><Field name="MinOrderQty" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The maximum quantity that should be ordered.</Line></Comment></Comments></Field><Field name="MaxOrderQty" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The minimum quantity that should be ordered.</Line></Comment></Comments></Field><Field name="OnOrderQty" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>The quantity currently on order.</Line></Comment></Comments></Field><Field name="UnitMeasureCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The product's unit of measure.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ProductVendor_ProductID_VendorID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ProductID</IndexField><IndexField>VendorID</IndexField></IndexFields></Index><Index name="IX_ProductVendor_UnitMeasureCode" clustered="No" unique="No"><IndexFields><IndexField>UnitMeasureCode</IndexField></IndexFields></Index><Index name="IX_ProductVendor_VendorID" clustered="No" unique="No"><IndexFields><IndexField>VendorID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ProductVendor_AverageLeadTime" text="([AverageLeadTime]&gt;=(1))"/><CheckConstraint name="CK_ProductVendor_StandardPrice" text="([StandardPrice]&gt;(0.00))"/><CheckConstraint name="CK_ProductVendor_LastReceiptCost" text="([LastReceiptCost]&gt;(0.00))"/><CheckConstraint name="CK_ProductVendor_MinOrderQty" text="([MinOrderQty]&gt;=(1))"/><CheckConstraint name="CK_ProductVendor_MaxOrderQty" text="([MaxOrderQty]&gt;=(1))"/><CheckConstraint name="CK_ProductVendor_OnOrderQty" text="([OnOrderQty]&gt;=(0))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_ProductVendor_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/><InternalForeignKey name="FK_ProductVendor_UnitMeasure_UnitMeasureCode" affectedField="UnitMeasureCode" sourceTable="Production.UnitMeasure"/><InternalForeignKey name="FK_ProductVendor_Vendor_VendorID" affectedField="VendorID" sourceTable="Purchasing.Vendor"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Purchasing.PurchaseOrderDetail" file="AdventureWorks_201011112041_Purchasing.PurchaseOrderDetail.html"><Descriptions><Description type="" text="Individual products associated with a specific purchase order. See PurchaseOrderHeader."/></Descriptions><PrimaryKeys><KeyField>PurchaseOrderID</KeyField><KeyField>PurchaseOrderDetailID</KeyField></PrimaryKeys><Fields><Field name="PurchaseOrderID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to PurchaseOrderHeader.PurchaseOrderID.</Line></Comment></Comments></Field><Field name="PurchaseOrderDetailID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. One line number per purchased product.</Line></Comment></Comments></Field><Field name="DueDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date the product is expected to be received.</Line></Comment></Comments></Field><Field name="OrderQty" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity ordered.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="UnitPrice" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Vendor's selling price of a single product.</Line></Comment></Comments></Field><Field name="LineTotal" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Per product subtotal. Computed as OrderQty * UnitPrice.</Line></Comment></Comments></Field><Field name="ReceivedQty" type="decimal (8, 2)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity actually received from the vendor.</Line></Comment></Comments></Field><Field name="RejectedQty" type="decimal (8, 2)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity rejected during inspection.</Line></Comment></Comments></Field><Field name="StockedQty" type="decimal (9, 2)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity accepted into inventory. Computed as ReceivedQty - RejectedQty.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID" clustered="Yes" unique="Yes"><IndexFields><IndexField>PurchaseOrderID</IndexField><IndexField>PurchaseOrderDetailID</IndexField></IndexFields></Index><Index name="IX_PurchaseOrderDetail_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_PurchaseOrderDetail_OrderQty" text="([OrderQty]&gt;(0))"/><CheckConstraint name="CK_PurchaseOrderDetail_UnitPrice" text="([UnitPrice]&gt;=(0.00))"/><CheckConstraint name="CK_PurchaseOrderDetail_ReceivedQty" text="([ReceivedQty]&gt;=(0.00))"/><CheckConstraint name="CK_PurchaseOrderDetail_RejectedQty" text="([RejectedQty]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_PurchaseOrderDetail_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/><InternalForeignKey name="FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID" affectedField="PurchaseOrderID" sourceTable="Purchasing.PurchaseOrderHeader"/></InternalForeignKeys><ExternalForeignKeys/><Triggers><Trigger name="iPurchaseOrderDetail"><Text><Line text="CREATE TRIGGER [Purchasing].[iPurchaseOrderDetail] ON [Purchasing].[PurchaseOrderDetail] "/><Line text="AFTER INSERT AS"/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="INSERT INTO [Production].[TransactionHistory]"/><Line text="([ProductID]"/><Line text=",[ReferenceOrderID]"/><Line text=",[ReferenceOrderLineID]"/><Line text=",[TransactionType]"/><Line text=",[TransactionDate]"/><Line text=",[Quantity]"/><Line text=",[ActualCost])"/><Line text="SELECT "/><Line text="inserted.[ProductID]"/><Line text=",inserted.[PurchaseOrderID]"/><Line text=",inserted.[PurchaseOrderDetailID]"/><Line text=",'P'"/><Line text=",GETDATE()"/><Line text=",inserted.[OrderQty]"/><Line text=",inserted.[UnitPrice]"/><Line text="FROM inserted "/><Line text="INNER JOIN [Purchasing].[PurchaseOrderHeader] "/><Line text="ON inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID];"/><Line text="UPDATE [Purchasing].[PurchaseOrderHeader]"/><Line text="SET [Purchasing].[PurchaseOrderHeader].[SubTotal] = "/><Line text="(SELECT SUM([Purchasing].[PurchaseOrderDetail].[LineTotal])"/><Line text="FROM [Purchasing].[PurchaseOrderDetail]"/><Line text="WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID])"/><Line text="WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] IN (SELECT inserted.[PurchaseOrderID] FROM inserted);"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger><Trigger name="uPurchaseOrderDetail"><Text><Line text="CREATE TRIGGER [Purchasing].[uPurchaseOrderDetail] ON [Purchasing].[PurchaseOrderDetail] "/><Line text="AFTER UPDATE AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="IF UPDATE([ProductID]) OR UPDATE([OrderQty]) OR UPDATE([UnitPrice])"/><Line text="BEGIN"/><Line text="INSERT INTO [Production].[TransactionHistory]"/><Line text="([ProductID]"/><Line text=",[ReferenceOrderID]"/><Line text=",[ReferenceOrderLineID]"/><Line text=",[TransactionType]"/><Line text=",[TransactionDate]"/><Line text=",[Quantity]"/><Line text=",[ActualCost])"/><Line text="SELECT "/><Line text="inserted.[ProductID]"/><Line text=",inserted.[PurchaseOrderID]"/><Line text=",inserted.[PurchaseOrderDetailID]"/><Line text=",'P'"/><Line text=",GETDATE()"/><Line text=",inserted.[OrderQty]"/><Line text=",inserted.[UnitPrice]"/><Line text="FROM inserted "/><Line text="INNER JOIN [Purchasing].[PurchaseOrderDetail] "/><Line text="ON inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID];"/><Line text="UPDATE [Purchasing].[PurchaseOrderHeader]"/><Line text="SET [Purchasing].[PurchaseOrderHeader].[SubTotal] = "/><Line text="(SELECT SUM([Purchasing].[PurchaseOrderDetail].[LineTotal])"/><Line text="FROM [Purchasing].[PurchaseOrderDetail]"/><Line text="WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] "/><Line text="= [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID])"/><Line text="WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] "/><Line text="IN (SELECT inserted.[PurchaseOrderID] FROM inserted);"/><Line text="UPDATE [Purchasing].[PurchaseOrderDetail]"/><Line text="SET [Purchasing].[PurchaseOrderDetail].[ModifiedDate] = GETDATE()"/><Line text="FROM inserted"/><Line text="WHERE inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID]"/><Line text="AND inserted.[PurchaseOrderDetailID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderDetailID];"/><Line text="END;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Purchasing.PurchaseOrderHeader" file="AdventureWorks_201011112041_Purchasing.PurchaseOrderHeader.html"><Descriptions><Description type="" text="General purchase order information. See PurchaseOrderDetail."/></Descriptions><PrimaryKeys><KeyField>PurchaseOrderID</KeyField></PrimaryKeys><Fields><Field name="PurchaseOrderID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key.</Line></Comment></Comments></Field><Field name="RevisionNumber" type="tinyint" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Incremental number to track changes to the purchase order over time.</Line></Comment></Comments></Field><Field name="Status" type="tinyint" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete</Line></Comment></Comments></Field><Field name="EmployeeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Employee who created the purchase order. Foreign key to Employee.EmployeeID.</Line></Comment></Comments></Field><Field name="VendorID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Vendor with whom the purchase order is placed. Foreign key to Vendor.VendorID.</Line></Comment></Comments></Field><Field name="ShipMethodID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shipping method. Foreign key to ShipMethod.ShipMethodID.</Line></Comment></Comments></Field><Field name="OrderDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Purchase order creation date.</Line></Comment></Comments></Field><Field name="ShipDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Estimated shipment date from the vendor.</Line></Comment></Comments></Field><Field name="SubTotal" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID.</Line></Comment></Comments></Field><Field name="TaxAmt" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Tax amount.</Line></Comment></Comments></Field><Field name="Freight" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Shipping cost.</Line></Comment></Comments></Field><Field name="TotalDue" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Total due to vendor. Computed as Subtotal + TaxAmt + Freight.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_PurchaseOrderHeader_PurchaseOrderID" clustered="Yes" unique="Yes"><IndexFields><IndexField>PurchaseOrderID</IndexField></IndexFields></Index><Index name="IX_PurchaseOrderHeader_VendorID" clustered="No" unique="No"><IndexFields><IndexField>VendorID</IndexField></IndexFields></Index><Index name="IX_PurchaseOrderHeader_EmployeeID" clustered="No" unique="No"><IndexFields><IndexField>EmployeeID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_PurchaseOrderHeader_Status" text="([Status]&gt;=(1) AND [Status]&lt;=(4))"/><CheckConstraint name="CK_PurchaseOrderHeader_ShipDate" text="([ShipDate]&gt;=[OrderDate] OR [ShipDate] IS NULL)"/><CheckConstraint name="CK_PurchaseOrderHeader_SubTotal" text="([SubTotal]&gt;=(0.00))"/><CheckConstraint name="CK_PurchaseOrderHeader_TaxAmt" text="([TaxAmt]&gt;=(0.00))"/><CheckConstraint name="CK_PurchaseOrderHeader_Freight" text="([Freight]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_PurchaseOrderHeader_Employee_EmployeeID" affectedField="EmployeeID" sourceTable="HumanResources.Employee"/><InternalForeignKey name="FK_PurchaseOrderHeader_ShipMethod_ShipMethodID" affectedField="ShipMethodID" sourceTable="Purchasing.ShipMethod"/><InternalForeignKey name="FK_PurchaseOrderHeader_Vendor_VendorID" affectedField="VendorID" sourceTable="Purchasing.Vendor"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID" affectedSchema="" affectedTable="Purchasing.PurchaseOrderDetail" affectedField="PurchaseOrderID"/></ExternalForeignKeys><Triggers><Trigger name="uPurchaseOrderHeader"><Text><Line text="CREATE TRIGGER [Purchasing].[uPurchaseOrderHeader] ON [Purchasing].[PurchaseOrderHeader] "/><Line text="AFTER UPDATE AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="IF NOT UPDATE([Status])"/><Line text="BEGIN"/><Line text="UPDATE [Purchasing].[PurchaseOrderHeader]"/><Line text="SET [Purchasing].[PurchaseOrderHeader].[RevisionNumber] = "/><Line text="[Purchasing].[PurchaseOrderHeader].[RevisionNumber] + 1"/><Line text="WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] IN "/><Line text="(SELECT inserted.[PurchaseOrderID] FROM inserted);"/><Line text="END;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Purchasing.ShipMethod" file="AdventureWorks_201011112041_Purchasing.ShipMethod.html"><Descriptions><Description type="" text="Shipping company lookup table."/></Descriptions><PrimaryKeys><KeyField>ShipMethodID</KeyField></PrimaryKeys><Fields><Field name="ShipMethodID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ShipMethod records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shipping company name.</Line></Comment></Comments></Field><Field name="ShipBase" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Minimum shipping charge.</Line></Comment></Comments></Field><Field name="ShipRate" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Shipping charge per pound.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ShipMethod_ShipMethodID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ShipMethodID</IndexField></IndexFields></Index><Index name="AK_ShipMethod_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_ShipMethod_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ShipMethod_ShipBase" text="([ShipBase]&gt;(0.00))"/><CheckConstraint name="CK_ShipMethod_ShipRate" text="([ShipRate]&gt;(0.00))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_PurchaseOrderHeader_ShipMethod_ShipMethodID" affectedSchema="" affectedTable="Purchasing.PurchaseOrderHeader" affectedField="ShipMethodID"/><ExternalForeignKey name="FK_SalesOrderHeader_ShipMethod_ShipMethodID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="ShipMethodID"/></ExternalForeignKeys><Triggers/></Table><Table name="Purchasing.Vendor" file="AdventureWorks_201011112041_Purchasing.Vendor.html"><Descriptions><Description type="" text="Companies from whom Adventure Works Cycles purchases parts or other goods."/></Descriptions><PrimaryKeys><KeyField>VendorID</KeyField></PrimaryKeys><Fields><Field name="VendorID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Vendor records.</Line></Comment></Comments></Field><Field name="AccountNumber" type="nvarchar (15)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Vendor account (identification) number.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Company name.</Line></Comment></Comments></Field><Field name="CreditRating" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average</Line></Comment></Comments></Field><Field name="PreferredVendorStatus" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product.</Line></Comment></Comments></Field><Field name="ActiveFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = Vendor no longer used. 1 = Vendor is actively used.</Line></Comment></Comments></Field><Field name="PurchasingWebServiceURL" type="nvarchar (1024)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Vendor URL.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Vendor_VendorID" clustered="Yes" unique="Yes"><IndexFields><IndexField>VendorID</IndexField></IndexFields></Index><Index name="AK_Vendor_AccountNumber" clustered="No" unique="Yes"><IndexFields><IndexField>AccountNumber</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Vendor_CreditRating" text="([CreditRating]&gt;=(1) AND [CreditRating]&lt;=(5))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ProductVendor_Vendor_VendorID" affectedSchema="" affectedTable="Purchasing.ProductVendor" affectedField="VendorID"/><ExternalForeignKey name="FK_PurchaseOrderHeader_Vendor_VendorID" affectedSchema="" affectedTable="Purchasing.PurchaseOrderHeader" affectedField="VendorID"/><ExternalForeignKey name="FK_VendorAddress_Vendor_VendorID" affectedSchema="" affectedTable="Purchasing.VendorAddress" affectedField="VendorID"/><ExternalForeignKey name="FK_VendorContact_Vendor_VendorID" affectedSchema="" affectedTable="Purchasing.VendorContact" affectedField="VendorID"/></ExternalForeignKeys><Triggers><Trigger name="dVendor"><Text><Line text="CREATE TRIGGER [Purchasing].[dVendor] ON [Purchasing].[Vendor] "/><Line text="INSTEAD OF DELETE NOT FOR REPLICATION AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="DECLARE @DeleteCount int;"/><Line text="SELECT @DeleteCount = COUNT(*) FROM deleted;"/><Line text="IF @DeleteCount &gt; 0 "/><Line text="BEGIN"/><Line text="RAISERROR"/><Line text="(N'Vendors cannot be deleted. They can only be marked as not active.', -- Message"/><Line text="10, -- Severity."/><Line text="1); -- State."/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="END;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Purchasing.VendorAddress" file="AdventureWorks_201011112041_Purchasing.VendorAddress.html"><Descriptions><Description type="" text="Cross-reference mapping vendors and addresses."/></Descriptions><PrimaryKeys><KeyField>VendorID</KeyField><KeyField>AddressID</KeyField></PrimaryKeys><Fields><Field name="VendorID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Vendor.VendorID.</Line></Comment></Comments></Field><Field name="AddressID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Address.AddressID.</Line></Comment></Comments></Field><Field name="AddressTypeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Address type. Foreign key to AddressType.AddressTypeID.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_VendorAddress_VendorID_AddressID" clustered="Yes" unique="Yes"><IndexFields><IndexField>VendorID</IndexField><IndexField>AddressID</IndexField></IndexFields></Index><Index name="IX_VendorAddress_AddressID" clustered="No" unique="No"><IndexFields><IndexField>AddressID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_VendorAddress_Address_AddressID" affectedField="AddressID" sourceTable="Person.Address"/><InternalForeignKey name="FK_VendorAddress_AddressType_AddressTypeID" affectedField="AddressTypeID" sourceTable="Person.AddressType"/><InternalForeignKey name="FK_VendorAddress_Vendor_VendorID" affectedField="VendorID" sourceTable="Purchasing.Vendor"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Purchasing.VendorContact" file="AdventureWorks_201011112041_Purchasing.VendorContact.html"><Descriptions><Description type="" text="Cross-reference table mapping vendors and their employees."/></Descriptions><PrimaryKeys><KeyField>VendorID</KeyField><KeyField>ContactID</KeyField></PrimaryKeys><Fields><Field name="VendorID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key.</Line></Comment></Comments></Field><Field name="ContactID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Contact (Vendor employee) identification number. Foreign key to Contact.ContactID.</Line></Comment></Comments></Field><Field name="ContactTypeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Contact type such as sales manager, or sales agent.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_VendorContact_VendorID_ContactID" clustered="Yes" unique="Yes"><IndexFields><IndexField>VendorID</IndexField><IndexField>ContactID</IndexField></IndexFields></Index><Index name="IX_VendorContact_ContactID" clustered="No" unique="No"><IndexFields><IndexField>ContactID</IndexField></IndexFields></Index><Index name="IX_VendorContact_ContactTypeID" clustered="No" unique="No"><IndexFields><IndexField>ContactTypeID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_VendorContact_Contact_ContactID" affectedField="ContactID" sourceTable="Person.Contact"/><InternalForeignKey name="FK_VendorContact_ContactType_ContactTypeID" affectedField="ContactTypeID" sourceTable="Person.ContactType"/><InternalForeignKey name="FK_VendorContact_Vendor_VendorID" affectedField="VendorID" sourceTable="Purchasing.Vendor"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.ContactCreditCard" file="AdventureWorks_201011112041_Sales.ContactCreditCard.html"><Descriptions><Description type="" text="Cross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table. "/></Descriptions><PrimaryKeys><KeyField>ContactID</KeyField><KeyField>CreditCardID</KeyField></PrimaryKeys><Fields><Field name="ContactID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Customer identification number. Foreign key to Contact.ContactID.</Line></Comment></Comments></Field><Field name="CreditCardID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Credit card identification number. Foreign key to CreditCard.CreditCardID.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ContactCreditCard_ContactID_CreditCardID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ContactID</IndexField><IndexField>CreditCardID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_ContactCreditCard_Contact_ContactID" affectedField="ContactID" sourceTable="Person.Contact"/><InternalForeignKey name="FK_ContactCreditCard_CreditCard_CreditCardID" affectedField="CreditCardID" sourceTable="Sales.CreditCard"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.CountryRegionCurrency" file="AdventureWorks_201011112041_Sales.CountryRegionCurrency.html"><Descriptions><Description type="" text="Cross-reference table mapping ISO currency codes to a country or region."/></Descriptions><PrimaryKeys><KeyField>CountryRegionCode</KeyField><KeyField>CurrencyCode</KeyField></PrimaryKeys><Fields><Field name="CountryRegionCode" type="nvarchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode.</Line></Comment></Comments></Field><Field name="CurrencyCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ISO standard currency code. Foreign key to Currency.CurrencyCode.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode" clustered="Yes" unique="Yes"><IndexFields><IndexField>CountryRegionCode</IndexField><IndexField>CurrencyCode</IndexField></IndexFields></Index><Index name="IX_CountryRegionCurrency_CurrencyCode" clustered="No" unique="No"><IndexFields><IndexField>CurrencyCode</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_CountryRegionCurrency_CountryRegion_CountryRegionCode" affectedField="CountryRegionCode" sourceTable="Person.CountryRegion"/><InternalForeignKey name="FK_CountryRegionCurrency_Currency_CurrencyCode" affectedField="CurrencyCode" sourceTable="Sales.Currency"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.CreditCard" file="AdventureWorks_201011112041_Sales.CreditCard.html"><Descriptions><Description type="" text="Customer credit card information."/></Descriptions><PrimaryKeys><KeyField>CreditCardID</KeyField></PrimaryKeys><Fields><Field name="CreditCardID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for CreditCard records.</Line></Comment></Comments></Field><Field name="CardType" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Credit card name.</Line></Comment></Comments></Field><Field name="CardNumber" type="nvarchar (25)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Credit card number.</Line></Comment></Comments></Field><Field name="ExpMonth" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Credit card expiration month.</Line></Comment></Comments></Field><Field name="ExpYear" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Credit card expiration year.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_CreditCard_CreditCardID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CreditCardID</IndexField></IndexFields></Index><Index name="AK_CreditCard_CardNumber" clustered="No" unique="Yes"><IndexFields><IndexField>CardNumber</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_ContactCreditCard_CreditCard_CreditCardID" affectedSchema="" affectedTable="Sales.ContactCreditCard" affectedField="CreditCardID"/><ExternalForeignKey name="FK_SalesOrderHeader_CreditCard_CreditCardID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="CreditCardID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.Currency" file="AdventureWorks_201011112041_Sales.Currency.html"><Descriptions><Description type="" text="Lookup table containing standard ISO currencies."/></Descriptions><PrimaryKeys><KeyField>CurrencyCode</KeyField></PrimaryKeys><Fields><Field name="CurrencyCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>The ISO code for the Currency.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Currency name.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Currency_CurrencyCode" clustered="Yes" unique="Yes"><IndexFields><IndexField>CurrencyCode</IndexField></IndexFields></Index><Index name="AK_Currency_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_CountryRegionCurrency_Currency_CurrencyCode" affectedSchema="" affectedTable="Sales.CountryRegionCurrency" affectedField="CurrencyCode"/><ExternalForeignKey name="FK_CurrencyRate_Currency_FromCurrencyCode" affectedSchema="" affectedTable="Sales.CurrencyRate" affectedField="FromCurrencyCode"/><ExternalForeignKey name="FK_CurrencyRate_Currency_ToCurrencyCode" affectedSchema="" affectedTable="Sales.CurrencyRate" affectedField="ToCurrencyCode"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.CurrencyRate" file="AdventureWorks_201011112041_Sales.CurrencyRate.html"><Descriptions><Description type="" text="Currency exchange rates."/></Descriptions><PrimaryKeys><KeyField>CurrencyRateID</KeyField></PrimaryKeys><Fields><Field name="CurrencyRateID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for CurrencyRate records.</Line></Comment></Comments></Field><Field name="CurrencyRateDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date and time the exchange rate was obtained.</Line></Comment></Comments></Field><Field name="FromCurrencyCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Exchange rate was converted from this currency code.</Line></Comment></Comments></Field><Field name="ToCurrencyCode" type="nchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Exchange rate was converted to this currency code.</Line></Comment></Comments></Field><Field name="AverageRate" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Average exchange rate for the day.</Line></Comment></Comments></Field><Field name="EndOfDayRate" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Final exchange rate for the day.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_CurrencyRate_CurrencyRateID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CurrencyRateID</IndexField></IndexFields></Index><Index name="AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode" clustered="No" unique="Yes"><IndexFields><IndexField>CurrencyRateDate</IndexField><IndexField>FromCurrencyCode</IndexField><IndexField>ToCurrencyCode</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_CurrencyRate_Currency_FromCurrencyCode" affectedField="FromCurrencyCode" sourceTable="Sales.Currency"/><InternalForeignKey name="FK_CurrencyRate_Currency_ToCurrencyCode" affectedField="ToCurrencyCode" sourceTable="Sales.Currency"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_SalesOrderHeader_CurrencyRate_CurrencyRateID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="CurrencyRateID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.Customer" file="AdventureWorks_201011112041_Sales.Customer.html"><Descriptions><Description type="" text="Current customer information. Also see the Individual and Store tables."/></Descriptions><PrimaryKeys><KeyField>CustomerID</KeyField></PrimaryKeys><Fields><Field name="CustomerID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for Customer records.</Line></Comment></Comments></Field><Field name="TerritoryID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.</Line></Comment></Comments></Field><Field name="AccountNumber" type="varchar (10)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unique number identifying the customer assigned by the accounting system.</Line></Comment></Comments></Field><Field name="CustomerType" type="nchar (1)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Customer type: I = Individual, S = Store</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Customer_CustomerID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CustomerID</IndexField></IndexFields></Index><Index name="AK_Customer_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="AK_Customer_AccountNumber" clustered="No" unique="Yes"><IndexFields><IndexField>AccountNumber</IndexField></IndexFields></Index><Index name="IX_Customer_TerritoryID" clustered="No" unique="No"><IndexFields><IndexField>TerritoryID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_Customer_CustomerType" text="(upper([CustomerType])='I' OR upper([CustomerType])='S')"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_Customer_SalesTerritory_TerritoryID" affectedField="TerritoryID" sourceTable="Sales.SalesTerritory"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_CustomerAddress_Customer_CustomerID" affectedSchema="" affectedTable="Sales.CustomerAddress" affectedField="CustomerID"/><ExternalForeignKey name="FK_Individual_Customer_CustomerID" affectedSchema="" affectedTable="Sales.Individual" affectedField="CustomerID"/><ExternalForeignKey name="FK_SalesOrderHeader_Customer_CustomerID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="CustomerID"/><ExternalForeignKey name="FK_Store_Customer_CustomerID" affectedSchema="" affectedTable="Sales.Store" affectedField="CustomerID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.CustomerAddress" file="AdventureWorks_201011112041_Sales.CustomerAddress.html"><Descriptions><Description type="" text="Cross-reference table mapping customers to their address(es)."/></Descriptions><PrimaryKeys><KeyField>CustomerID</KeyField><KeyField>AddressID</KeyField></PrimaryKeys><Fields><Field name="CustomerID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Customer.CustomerID.</Line></Comment></Comments></Field><Field name="AddressID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Address.AddressID.</Line></Comment></Comments></Field><Field name="AddressTypeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Address type. Foreign key to AddressType.AddressTypeID.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_CustomerAddress_CustomerID_AddressID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CustomerID</IndexField><IndexField>AddressID</IndexField></IndexFields></Index><Index name="AK_CustomerAddress_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_CustomerAddress_Address_AddressID" affectedField="AddressID" sourceTable="Person.Address"/><InternalForeignKey name="FK_CustomerAddress_AddressType_AddressTypeID" affectedField="AddressTypeID" sourceTable="Person.AddressType"/><InternalForeignKey name="FK_CustomerAddress_Customer_CustomerID" affectedField="CustomerID" sourceTable="Sales.Customer"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.Individual" file="AdventureWorks_201011112041_Sales.Individual.html"><Descriptions><Description type="" text="Demographic data about customers that purchase Adventure Works products online."/></Descriptions><PrimaryKeys><KeyField>CustomerID</KeyField></PrimaryKeys><Fields><Field name="CustomerID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unique customer identification number. Foreign key to Customer.CustomerID.</Line></Comment></Comments></Field><Field name="ContactID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Identifies the customer in the Contact table. Foreign key to Contact.ContactID.</Line></Comment></Comments></Field><Field name="Demographics" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Individual_CustomerID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CustomerID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_Individual_Contact_ContactID" affectedField="ContactID" sourceTable="Person.Contact"/><InternalForeignKey name="FK_Individual_Customer_CustomerID" affectedField="CustomerID" sourceTable="Sales.Customer"/></InternalForeignKeys><ExternalForeignKeys/><Triggers><Trigger name="iuIndividual"><Text><Line text="CREATE TRIGGER [Sales].[iuIndividual] ON [Sales].[Individual] "/><Line text="AFTER INSERT, UPDATE NOT FOR REPLICATION AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="IF EXISTS (SELECT * FROM inserted INNER JOIN [Sales].[Store] "/><Line text="ON inserted.[CustomerID] = [Sales].[Store].[CustomerID]) "/><Line text="BEGIN"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="END;"/><Line text="IF UPDATE([CustomerID]) OR UPDATE([Demographics]) "/><Line text="BEGIN"/><Line text="UPDATE [Sales].[Individual] "/><Line text="SET [Sales].[Individual].[Demographics] = N'&lt;IndividualSurvey xmlns=&quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-"/><Line text="works/IndividualSurvey&quot;&gt; "/><Line text="&lt;TotalPurchaseYTD&gt;0.00&lt;/TotalPurchaseYTD&gt; "/><Line text="&lt;/IndividualSurvey&gt;' "/><Line text="FROM inserted "/><Line text="WHERE [Sales].[Individual].[CustomerID] = inserted.[CustomerID] "/><Line text="AND inserted.[Demographics] IS NULL;"/><Line text=""/><Line text="UPDATE [Sales].[Individual] "/><Line text="SET [Demographics].modify(N'declare default element namespace &quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-"/><Line text="works/IndividualSurvey&quot;; "/><Line text="insert &lt;TotalPurchaseYTD&gt;0.00&lt;/TotalPurchaseYTD&gt; "/><Line text="as first "/><Line text="into (/IndividualSurvey)[1]') "/><Line text="FROM inserted "/><Line text="WHERE [Sales].[Individual].[CustomerID] = inserted.[CustomerID] "/><Line text="AND inserted.[Demographics] IS NOT NULL "/><Line text="AND inserted.[Demographics].exist(N'declare default element namespace "/><Line text="&quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey&quot;; "/><Line text="/IndividualSurvey/TotalPurchaseYTD') &lt;&gt; 1;"/><Line text="END;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Sales.SalesOrderDetail" file="AdventureWorks_201011112041_Sales.SalesOrderDetail.html"><Descriptions><Description type="" text="Individual products associated with a specific sales order. See SalesOrderHeader."/></Descriptions><PrimaryKeys><KeyField>SalesOrderID</KeyField><KeyField>SalesOrderDetailID</KeyField></PrimaryKeys><Fields><Field name="SalesOrderID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to SalesOrderHeader.SalesOrderID.</Line></Comment></Comments></Field><Field name="SalesOrderDetailID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. One incremental unique number per product sold.</Line></Comment></Comments></Field><Field name="CarrierTrackingNumber" type="nvarchar (25)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Shipment tracking number supplied by the shipper.</Line></Comment></Comments></Field><Field name="OrderQty" type="smallint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Quantity ordered per product.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product sold to customer. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="SpecialOfferID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Promotional code. Foreign key to SpecialOffer.SpecialOfferID.</Line></Comment></Comments></Field><Field name="UnitPrice" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Selling price of a single product.</Line></Comment></Comments></Field><Field name="UnitPriceDiscount" type="money" defaults="((0.0))" nullable="No"><Comments><Comment type="Description"><Line>Discount amount.</Line></Comment></Comments></Field><Field name="LineTotal" type="numeric (38, 6)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesOrderID</IndexField><IndexField>SalesOrderDetailID</IndexField></IndexFields></Index><Index name="AK_SalesOrderDetail_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_SalesOrderDetail_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesOrderDetail_OrderQty" text="([OrderQty]&gt;(0))"/><CheckConstraint name="CK_SalesOrderDetail_UnitPrice" text="([UnitPrice]&gt;=(0.00))"/><CheckConstraint name="CK_SalesOrderDetail_UnitPriceDiscount" text="([UnitPriceDiscount]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID" affectedField="SalesOrderID" sourceTable="Sales.SalesOrderHeader"/><InternalForeignKey name="FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID" affectedField="ProductID" sourceTable="Sales.SpecialOfferProduct"/><InternalForeignKey name="FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID" affectedField="SpecialOfferID" sourceTable="Sales.SpecialOfferProduct"/></InternalForeignKeys><ExternalForeignKeys/><Triggers><Trigger name="iduSalesOrderDetail"><Text><Line text="CREATE TRIGGER [Sales].[iduSalesOrderDetail] ON [Sales].[SalesOrderDetail] "/><Line text="AFTER INSERT, DELETE, UPDATE AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="IF UPDATE([ProductID]) OR UPDATE([OrderQty]) OR UPDATE([UnitPrice]) OR UPDATE([UnitPriceDiscount]) "/><Line text="BEGIN"/><Line text="INSERT INTO [Production].[TransactionHistory]"/><Line text="([ProductID]"/><Line text=",[ReferenceOrderID]"/><Line text=",[ReferenceOrderLineID]"/><Line text=",[TransactionType]"/><Line text=",[TransactionDate]"/><Line text=",[Quantity]"/><Line text=",[ActualCost])"/><Line text="SELECT "/><Line text="inserted.[ProductID]"/><Line text=",inserted.[SalesOrderID]"/><Line text=",inserted.[SalesOrderDetailID]"/><Line text=",'S'"/><Line text=",GETDATE()"/><Line text=",inserted.[OrderQty]"/><Line text=",inserted.[UnitPrice]"/><Line text="FROM inserted "/><Line text="INNER JOIN [Sales].[SalesOrderHeader] "/><Line text="ON inserted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID];"/><Line text="UPDATE [Sales].[Individual] "/><Line text="SET [Demographics].modify('declare default element namespace "/><Line text="&quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey&quot;; "/><Line text="replace value of (/IndividualSurvey/TotalPurchaseYTD)[1] "/><Line text="with data(/IndividualSurvey/TotalPurchaseYTD)[1] + sql:column (&quot;inserted.LineTotal&quot;)') "/><Line text="FROM inserted "/><Line text="INNER JOIN [Sales].[SalesOrderHeader] "/><Line text="ON inserted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID] "/><Line text="WHERE [Sales].[SalesOrderHeader].[CustomerID] = [Sales].[Individual].[CustomerID];"/><Line text="END;"/><Line text="UPDATE [Sales].[SalesOrderHeader]"/><Line text="SET [Sales].[SalesOrderHeader].[SubTotal] = "/><Line text="(SELECT SUM([Sales].[SalesOrderDetail].[LineTotal])"/><Line text="FROM [Sales].[SalesOrderDetail]"/><Line text="WHERE [Sales].[SalesOrderHeader].[SalesOrderID] = [Sales].[SalesOrderDetail].[SalesOrderID])"/><Line text="WHERE [Sales].[SalesOrderHeader].[SalesOrderID] IN (SELECT inserted.[SalesOrderID] FROM inserted);"/><Line text="UPDATE [Sales].[Individual] "/><Line text="SET [Demographics].modify('declare default element namespace "/><Line text="&quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey&quot;; "/><Line text="replace value of (/IndividualSurvey/TotalPurchaseYTD)[1] "/><Line text="with data(/IndividualSurvey/TotalPurchaseYTD)[1] - sql:column(&quot;deleted.LineTotal&quot;)') "/><Line text="FROM deleted "/><Line text="INNER JOIN [Sales].[SalesOrderHeader] "/><Line text="ON deleted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID] "/><Line text="WHERE [Sales].[SalesOrderHeader].[CustomerID] = [Sales].[Individual].[CustomerID];"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Sales.SalesOrderHeader" file="AdventureWorks_201011112041_Sales.SalesOrderHeader.html"><Descriptions><Description type="" text="General sales order information."/></Descriptions><PrimaryKeys><KeyField>SalesOrderID</KeyField></PrimaryKeys><Fields><Field name="SalesOrderID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key.</Line></Comment></Comments></Field><Field name="RevisionNumber" type="tinyint" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Incremental number to track changes to the sales order over time.</Line></Comment></Comments></Field><Field name="OrderDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Dates the sales order was created.</Line></Comment></Comments></Field><Field name="DueDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date the order is due to the customer.</Line></Comment></Comments></Field><Field name="ShipDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the order was shipped to the customer.</Line></Comment></Comments></Field><Field name="Status" type="tinyint" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled</Line></Comment></Comments></Field><Field name="OnlineOrderFlag" type="bit" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>0 = Order placed by sales person. 1 = Order placed online by customer.</Line></Comment></Comments></Field><Field name="SalesOrderNumber" type="nvarchar (25)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Unique sales order identification number.</Line></Comment></Comments></Field><Field name="PurchaseOrderNumber" type="nvarchar (25)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Customer purchase order number reference. </Line></Comment></Comments></Field><Field name="AccountNumber" type="nvarchar (15)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Financial accounting number reference.</Line></Comment></Comments></Field><Field name="CustomerID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Customer identification number. Foreign key to Customer.CustomerID.</Line></Comment></Comments></Field><Field name="ContactID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Customer contact identification number. Foreign key to Contact.ContactID.</Line></Comment></Comments></Field><Field name="SalesPersonID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.</Line></Comment></Comments></Field><Field name="TerritoryID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.</Line></Comment></Comments></Field><Field name="BillToAddressID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Customer billing address. Foreign key to Address.AddressID.</Line></Comment></Comments></Field><Field name="ShipToAddressID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Customer shipping address. Foreign key to Address.AddressID.</Line></Comment></Comments></Field><Field name="ShipMethodID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shipping method. Foreign key to ShipMethod.ShipMethodID.</Line></Comment></Comments></Field><Field name="CreditCardID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Credit card identification number. Foreign key to CreditCard.CreditCardID.</Line></Comment></Comments></Field><Field name="CreditCardApprovalCode" type="varchar (15)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Approval code provided by the credit card company.</Line></Comment></Comments></Field><Field name="CurrencyRateID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.</Line></Comment></Comments></Field><Field name="SubTotal" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.</Line></Comment></Comments></Field><Field name="TaxAmt" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Tax amount.</Line></Comment></Comments></Field><Field name="Freight" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Shipping cost.</Line></Comment></Comments></Field><Field name="TotalDue" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Total due from customer. Computed as Subtotal + TaxAmt + Freight.</Line></Comment></Comments></Field><Field name="Comment" type="nvarchar (128)" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Sales representative comments.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesOrderHeader_SalesOrderID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesOrderID</IndexField></IndexFields></Index><Index name="AK_SalesOrderHeader_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="AK_SalesOrderHeader_SalesOrderNumber" clustered="No" unique="Yes"><IndexFields><IndexField>SalesOrderNumber</IndexField></IndexFields></Index><Index name="IX_SalesOrderHeader_CustomerID" clustered="No" unique="No"><IndexFields><IndexField>CustomerID</IndexField></IndexFields></Index><Index name="IX_SalesOrderHeader_SalesPersonID" clustered="No" unique="No"><IndexFields><IndexField>SalesPersonID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesOrderHeader_Status" text="([Status]&gt;=(0) AND [Status]&lt;=(8))"/><CheckConstraint name="CK_SalesOrderHeader_DueDate" text="([DueDate]&gt;=[OrderDate])"/><CheckConstraint name="CK_SalesOrderHeader_ShipDate" text="([ShipDate]&gt;=[OrderDate] OR [ShipDate] IS NULL)"/><CheckConstraint name="CK_SalesOrderHeader_SubTotal" text="([SubTotal]&gt;=(0.00))"/><CheckConstraint name="CK_SalesOrderHeader_TaxAmt" text="([TaxAmt]&gt;=(0.00))"/><CheckConstraint name="CK_SalesOrderHeader_Freight" text="([Freight]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_SalesOrderHeader_Address_BillToAddressID" affectedField="BillToAddressID" sourceTable="Person.Address"/><InternalForeignKey name="FK_SalesOrderHeader_Address_ShipToAddressID" affectedField="ShipToAddressID" sourceTable="Person.Address"/><InternalForeignKey name="FK_SalesOrderHeader_Contact_ContactID" affectedField="ContactID" sourceTable="Person.Contact"/><InternalForeignKey name="FK_SalesOrderHeader_CreditCard_CreditCardID" affectedField="CreditCardID" sourceTable="Sales.CreditCard"/><InternalForeignKey name="FK_SalesOrderHeader_CurrencyRate_CurrencyRateID" affectedField="CurrencyRateID" sourceTable="Sales.CurrencyRate"/><InternalForeignKey name="FK_SalesOrderHeader_Customer_CustomerID" affectedField="CustomerID" sourceTable="Sales.Customer"/><InternalForeignKey name="FK_SalesOrderHeader_SalesPerson_SalesPersonID" affectedField="SalesPersonID" sourceTable="Sales.SalesPerson"/><InternalForeignKey name="FK_SalesOrderHeader_SalesTerritory_TerritoryID" affectedField="TerritoryID" sourceTable="Sales.SalesTerritory"/><InternalForeignKey name="FK_SalesOrderHeader_ShipMethod_ShipMethodID" affectedField="ShipMethodID" sourceTable="Purchasing.ShipMethod"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID" affectedSchema="" affectedTable="Sales.SalesOrderDetail" affectedField="SalesOrderID"/><ExternalForeignKey name="FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID" affectedSchema="" affectedTable="Sales.SalesOrderHeaderSalesReason" affectedField="SalesOrderID"/></ExternalForeignKeys><Triggers><Trigger name="uSalesOrderHeader"><Text><Line text="CREATE TRIGGER [Sales].[uSalesOrderHeader] ON [Sales].[SalesOrderHeader] "/><Line text="AFTER UPDATE NOT FOR REPLICATION AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="IF NOT UPDATE([Status])"/><Line text="BEGIN"/><Line text="UPDATE [Sales].[SalesOrderHeader]"/><Line text="SET [Sales].[SalesOrderHeader].[RevisionNumber] = "/><Line text="[Sales].[SalesOrderHeader].[RevisionNumber] + 1"/><Line text="WHERE [Sales].[SalesOrderHeader].[SalesOrderID] IN "/><Line text="(SELECT inserted.[SalesOrderID] FROM inserted);"/><Line text="END;"/><Line text="IF UPDATE([SubTotal])"/><Line text="BEGIN"/><Line text="DECLARE @StartDate datetime,"/><Line text="@EndDate datetime"/><Line text="SET @StartDate = [dbo].[ufnGetAccountingStartDate]();"/><Line text="SET @EndDate = [dbo].[ufnGetAccountingEndDate]();"/><Line text="UPDATE [Sales].[SalesPerson]"/><Line text="SET [Sales].[SalesPerson].[SalesYTD] = "/><Line text="(SELECT SUM([Sales].[SalesOrderHeader].[SubTotal])"/><Line text="FROM [Sales].[SalesOrderHeader] "/><Line text="WHERE [Sales].[SalesPerson].[SalesPersonID] = [Sales].[SalesOrderHeader].[SalesPersonID]"/><Line text="AND ([Sales].[SalesOrderHeader].[Status] = 5) -- Shipped"/><Line text="AND [Sales].[SalesOrderHeader].[OrderDate] BETWEEN @StartDate AND @EndDate)"/><Line text="WHERE [Sales].[SalesPerson].[SalesPersonID] "/><Line text="IN (SELECT DISTINCT inserted.[SalesPersonID] FROM inserted "/><Line text="WHERE inserted.[OrderDate] BETWEEN @StartDate AND @EndDate);"/><Line text="UPDATE [Sales].[SalesTerritory]"/><Line text="SET [Sales].[SalesTerritory].[SalesYTD] = "/><Line text="(SELECT SUM([Sales].[SalesOrderHeader].[SubTotal])"/><Line text="FROM [Sales].[SalesOrderHeader] "/><Line text="WHERE [Sales].[SalesTerritory].[TerritoryID] = [Sales].[SalesOrderHeader].[TerritoryID]"/><Line text="AND ([Sales].[SalesOrderHeader].[Status] = 5) -- Shipped"/><Line text="AND [Sales].[SalesOrderHeader].[OrderDate] BETWEEN @StartDate AND @EndDate)"/><Line text="WHERE [Sales].[SalesTerritory].[TerritoryID] "/><Line text="IN (SELECT DISTINCT inserted.[TerritoryID] FROM inserted "/><Line text="WHERE inserted.[OrderDate] BETWEEN @StartDate AND @EndDate);"/><Line text="END;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Sales.SalesOrderHeaderSalesReason" file="AdventureWorks_201011112041_Sales.SalesOrderHeaderSalesReason.html"><Descriptions><Description type="" text="Cross-reference table mapping sales orders to sales reason codes."/></Descriptions><PrimaryKeys><KeyField>SalesOrderID</KeyField><KeyField>SalesReasonID</KeyField></PrimaryKeys><Fields><Field name="SalesOrderID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to SalesOrderHeader.SalesOrderID.</Line></Comment></Comments></Field><Field name="SalesReasonID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to SalesReason.SalesReasonID.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesOrderID</IndexField><IndexField>SalesReasonID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID" affectedField="SalesOrderID" sourceTable="Sales.SalesOrderHeader"/><InternalForeignKey name="FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID" affectedField="SalesReasonID" sourceTable="Sales.SalesReason"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.SalesPerson" file="AdventureWorks_201011112041_Sales.SalesPerson.html"><Descriptions><Description type="" text="Sales representative current information."/></Descriptions><PrimaryKeys><KeyField>SalesPersonID</KeyField></PrimaryKeys><Fields><Field name="SalesPersonID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SalesPerson records.</Line></Comment></Comments></Field><Field name="TerritoryID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Territory currently assigned to. Foreign key to SalesTerritory.SalesTerritoryID.</Line></Comment></Comments></Field><Field name="SalesQuota" type="money" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Projected yearly sales.</Line></Comment></Comments></Field><Field name="Bonus" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Bonus due if quota is met.</Line></Comment></Comments></Field><Field name="CommissionPct" type="smallmoney" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Commision percent received per sale.</Line></Comment></Comments></Field><Field name="SalesYTD" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Sales total year to date.</Line></Comment></Comments></Field><Field name="SalesLastYear" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Sales total of previous year.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesPerson_SalesPersonID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesPersonID</IndexField></IndexFields></Index><Index name="AK_SalesPerson_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesPerson_SalesQuota" text="([SalesQuota]&gt;(0.00))"/><CheckConstraint name="CK_SalesPerson_Bonus" text="([Bonus]&gt;=(0.00))"/><CheckConstraint name="CK_SalesPerson_CommissionPct" text="([CommissionPct]&gt;=(0.00))"/><CheckConstraint name="CK_SalesPerson_SalesYTD" text="([SalesYTD]&gt;=(0.00))"/><CheckConstraint name="CK_SalesPerson_SalesLastYear" text="([SalesLastYear]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_SalesPerson_Employee_SalesPersonID" affectedField="SalesPersonID" sourceTable="HumanResources.Employee"/><InternalForeignKey name="FK_SalesPerson_SalesTerritory_TerritoryID" affectedField="TerritoryID" sourceTable="Sales.SalesTerritory"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_SalesOrderHeader_SalesPerson_SalesPersonID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="SalesPersonID"/><ExternalForeignKey name="FK_SalesPersonQuotaHistory_SalesPerson_SalesPersonID" affectedSchema="" affectedTable="Sales.SalesPersonQuotaHistory" affectedField="SalesPersonID"/><ExternalForeignKey name="FK_SalesTerritoryHistory_SalesPerson_SalesPersonID" affectedSchema="" affectedTable="Sales.SalesTerritoryHistory" affectedField="SalesPersonID"/><ExternalForeignKey name="FK_Store_SalesPerson_SalesPersonID" affectedSchema="" affectedTable="Sales.Store" affectedField="SalesPersonID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.SalesPersonQuotaHistory" file="AdventureWorks_201011112041_Sales.SalesPersonQuotaHistory.html"><Descriptions><Description type="" text="Sales performance tracking."/></Descriptions><PrimaryKeys><KeyField>SalesPersonID</KeyField><KeyField>QuotaDate</KeyField></PrimaryKeys><Fields><Field name="SalesPersonID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Sales person identification number. Foreign key to SalesPerson.SalesPersonID.</Line></Comment></Comments></Field><Field name="QuotaDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Sales quota date.</Line></Comment></Comments></Field><Field name="SalesQuota" type="money" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Sales quota amount.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesPersonQuotaHistory_SalesPersonID_QuotaDate" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesPersonID</IndexField><IndexField>QuotaDate</IndexField></IndexFields></Index><Index name="AK_SalesPersonQuotaHistory_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesPersonQuotaHistory_SalesQuota" text="([SalesQuota]&gt;(0.00))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_SalesPersonQuotaHistory_SalesPerson_SalesPersonID" affectedField="SalesPersonID" sourceTable="Sales.SalesPerson"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.SalesReason" file="AdventureWorks_201011112041_Sales.SalesReason.html"><Descriptions><Description type="" text="Lookup table of customer purchase reasons."/></Descriptions><PrimaryKeys><KeyField>SalesReasonID</KeyField></PrimaryKeys><Fields><Field name="SalesReasonID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SalesReason records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Sales reason description.</Line></Comment></Comments></Field><Field name="ReasonType" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Category the sales reason belongs to.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesReason_SalesReasonID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesReasonID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID" affectedSchema="" affectedTable="Sales.SalesOrderHeaderSalesReason" affectedField="SalesReasonID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.SalesTaxRate" file="AdventureWorks_201011112041_Sales.SalesTaxRate.html"><Descriptions><Description type="" text="Tax rate lookup table."/></Descriptions><PrimaryKeys><KeyField>SalesTaxRateID</KeyField></PrimaryKeys><Fields><Field name="SalesTaxRateID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SalesTaxRate records.</Line></Comment></Comments></Field><Field name="StateProvinceID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>State, province, or country/region the sales tax applies to.</Line></Comment></Comments></Field><Field name="TaxType" type="tinyint" defaults="" nullable="No"><Comments><Comment type="Description"><Line>1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions.</Line></Comment></Comments></Field><Field name="TaxRate" type="smallmoney" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Tax rate amount.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Tax rate description.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesTaxRate_SalesTaxRateID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesTaxRateID</IndexField></IndexFields></Index><Index name="AK_SalesTaxRate_StateProvinceID_TaxType" clustered="No" unique="Yes"><IndexFields><IndexField>StateProvinceID</IndexField><IndexField>TaxType</IndexField></IndexFields></Index><Index name="AK_SalesTaxRate_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesTaxRate_TaxType" text="([TaxType]&gt;=(1) AND [TaxType]&lt;=(3))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_SalesTaxRate_StateProvince_StateProvinceID" affectedField="StateProvinceID" sourceTable="Person.StateProvince"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.SalesTerritory" file="AdventureWorks_201011112041_Sales.SalesTerritory.html"><Descriptions><Description type="" text="Sales territory lookup table."/></Descriptions><PrimaryKeys><KeyField>TerritoryID</KeyField></PrimaryKeys><Fields><Field name="TerritoryID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SalesTerritory records.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Sales territory description</Line></Comment></Comments></Field><Field name="CountryRegionCode" type="nvarchar (3)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. </Line></Comment></Comments></Field><Field name="Group" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Geographic area to which the sales territory belong.</Line></Comment></Comments></Field><Field name="SalesYTD" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Sales in the territory year to date.</Line></Comment></Comments></Field><Field name="SalesLastYear" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Sales in the territory the previous year.</Line></Comment></Comments></Field><Field name="CostYTD" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Business costs in the territory year to date.</Line></Comment></Comments></Field><Field name="CostLastYear" type="money" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Business costs in the territory the previous year.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesTerritory_TerritoryID" clustered="Yes" unique="Yes"><IndexFields><IndexField>TerritoryID</IndexField></IndexFields></Index><Index name="AK_SalesTerritory_Name" clustered="No" unique="Yes"><IndexFields><IndexField>Name</IndexField></IndexFields></Index><Index name="AK_SalesTerritory_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesTerritory_SalesYTD" text="([SalesYTD]&gt;=(0.00))"/><CheckConstraint name="CK_SalesTerritory_SalesLastYear" text="([SalesLastYear]&gt;=(0.00))"/><CheckConstraint name="CK_SalesTerritory_CostYTD" text="([CostYTD]&gt;=(0.00))"/><CheckConstraint name="CK_SalesTerritory_CostLastYear" text="([CostLastYear]&gt;=(0.00))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_Customer_SalesTerritory_TerritoryID" affectedSchema="" affectedTable="Sales.Customer" affectedField="TerritoryID"/><ExternalForeignKey name="FK_SalesOrderHeader_SalesTerritory_TerritoryID" affectedSchema="" affectedTable="Sales.SalesOrderHeader" affectedField="TerritoryID"/><ExternalForeignKey name="FK_SalesPerson_SalesTerritory_TerritoryID" affectedSchema="" affectedTable="Sales.SalesPerson" affectedField="TerritoryID"/><ExternalForeignKey name="FK_SalesTerritoryHistory_SalesTerritory_TerritoryID" affectedSchema="" affectedTable="Sales.SalesTerritoryHistory" affectedField="TerritoryID"/><ExternalForeignKey name="FK_StateProvince_SalesTerritory_TerritoryID" affectedSchema="" affectedTable="Person.StateProvince" affectedField="TerritoryID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.SalesTerritoryHistory" file="AdventureWorks_201011112041_Sales.SalesTerritoryHistory.html"><Descriptions><Description type="" text="Sales representative transfers to other sales territories."/></Descriptions><PrimaryKeys><KeyField>SalesPersonID</KeyField><KeyField>StartDate</KeyField><KeyField>TerritoryID</KeyField></PrimaryKeys><Fields><Field name="SalesPersonID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SalesTerritoryHistory records.</Line></Comment></Comments></Field><Field name="TerritoryID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Date the sales representive started work in the territory.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Date the sales representative left work in the territory.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SalesPersonID</IndexField><IndexField>StartDate</IndexField><IndexField>TerritoryID</IndexField></IndexFields></Index><Index name="AK_SalesTerritoryHistory_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SalesTerritoryHistory_EndDate" text="([EndDate]&gt;=[StartDate] OR [EndDate] IS NULL)"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_SalesTerritoryHistory_SalesPerson_SalesPersonID" affectedField="SalesPersonID" sourceTable="Sales.SalesPerson"/><InternalForeignKey name="FK_SalesTerritoryHistory_SalesTerritory_TerritoryID" affectedField="TerritoryID" sourceTable="Sales.SalesTerritory"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.ShoppingCartItem" file="AdventureWorks_201011112041_Sales.ShoppingCartItem.html"><Descriptions><Description type="" text="Contains online customer orders until the order is submitted or cancelled."/></Descriptions><PrimaryKeys><KeyField>ShoppingCartItemID</KeyField></PrimaryKeys><Fields><Field name="ShoppingCartItemID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for ShoppingCartItem records.</Line></Comment></Comments></Field><Field name="ShoppingCartID" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Shopping cart identification number.</Line></Comment></Comments></Field><Field name="Quantity" type="int" defaults="((1))" nullable="No"><Comments><Comment type="Description"><Line>Product quantity ordered.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product ordered. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="DateCreated" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date the time the record was created.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_ShoppingCartItem_ShoppingCartItemID" clustered="Yes" unique="Yes"><IndexFields><IndexField>ShoppingCartItemID</IndexField></IndexFields></Index><Index name="IX_ShoppingCartItem_ShoppingCartID_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ShoppingCartID</IndexField><IndexField>ProductID</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_ShoppingCartItem_Quantity" text="([Quantity]&gt;=(1))"/></CheckConstraints><InternalForeignKeys><InternalForeignKey name="FK_ShoppingCartItem_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table><Table name="Sales.SpecialOffer" file="AdventureWorks_201011112041_Sales.SpecialOffer.html"><Descriptions><Description type="" text="Sale discounts lookup table."/></Descriptions><PrimaryKeys><KeyField>SpecialOfferID</KeyField></PrimaryKeys><Fields><Field name="SpecialOfferID" type="int - Identity" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SpecialOffer records.</Line></Comment></Comments></Field><Field name="Description" type="nvarchar (255)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Discount description.</Line></Comment></Comments></Field><Field name="DiscountPct" type="smallmoney" defaults="((0.00))" nullable="No"><Comments><Comment type="Description"><Line>Discount precentage.</Line></Comment></Comments></Field><Field name="Type" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Discount type category.</Line></Comment></Comments></Field><Field name="Category" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Group the discount applies to such as Reseller or Customer.</Line></Comment></Comments></Field><Field name="StartDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Discount start date.</Line></Comment></Comments></Field><Field name="EndDate" type="datetime" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Discount end date.</Line></Comment></Comments></Field><Field name="MinQty" type="int" defaults="((0))" nullable="No"><Comments><Comment type="Description"><Line>Minimum discount percent allowed.</Line></Comment></Comments></Field><Field name="MaxQty" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Maximum discount percent allowed.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SpecialOffer_SpecialOfferID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SpecialOfferID</IndexField></IndexFields></Index><Index name="AK_SpecialOffer_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index></Indexes><CheckConstraints><CheckConstraint name="CK_SpecialOffer_EndDate" text="([EndDate]&gt;=[StartDate])"/><CheckConstraint name="CK_SpecialOffer_DiscountPct" text="([DiscountPct]&gt;=(0.00))"/><CheckConstraint name="CK_SpecialOffer_MinQty" text="([MinQty]&gt;=(0))"/><CheckConstraint name="CK_SpecialOffer_MaxQty" text="([MaxQty]&gt;=(0))"/></CheckConstraints><InternalForeignKeys/><ExternalForeignKeys><ExternalForeignKey name="FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID" affectedSchema="" affectedTable="Sales.SpecialOfferProduct" affectedField="SpecialOfferID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.SpecialOfferProduct" file="AdventureWorks_201011112041_Sales.SpecialOfferProduct.html"><Descriptions><Description type="" text="Cross-reference table mapping products to special offer discounts."/></Descriptions><PrimaryKeys><KeyField>SpecialOfferID</KeyField><KeyField>ProductID</KeyField></PrimaryKeys><Fields><Field name="SpecialOfferID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key for SpecialOfferProduct records.</Line></Comment></Comments></Field><Field name="ProductID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Product identification number. Foreign key to Product.ProductID.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_SpecialOfferProduct_SpecialOfferID_ProductID" clustered="Yes" unique="Yes"><IndexFields><IndexField>SpecialOfferID</IndexField><IndexField>ProductID</IndexField></IndexFields></Index><Index name="AK_SpecialOfferProduct_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_SpecialOfferProduct_ProductID" clustered="No" unique="No"><IndexFields><IndexField>ProductID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_SpecialOfferProduct_Product_ProductID" affectedField="ProductID" sourceTable="Production.Product"/><InternalForeignKey name="FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID" affectedField="SpecialOfferID" sourceTable="Sales.SpecialOffer"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID" affectedSchema="" affectedTable="Sales.SalesOrderDetail" affectedField="ProductID"/><ExternalForeignKey name="FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID" affectedSchema="" affectedTable="Sales.SalesOrderDetail" affectedField="SpecialOfferID"/></ExternalForeignKeys><Triggers/></Table><Table name="Sales.Store" file="AdventureWorks_201011112041_Sales.Store.html"><Descriptions><Description type="" text="Customers (resellers) of Adventure Works products."/></Descriptions><PrimaryKeys><KeyField>CustomerID</KeyField></PrimaryKeys><Fields><Field name="CustomerID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Primary key. Foreign key to Customer.CustomerID.</Line></Comment></Comments></Field><Field name="Name" type="nvarchar (50)" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Name of the store.</Line></Comment></Comments></Field><Field name="SalesPersonID" type="int" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID.</Line></Comment></Comments></Field><Field name="Demographics" type="xml" defaults="" nullable="Yes"><Comments><Comment type="Description"><Line>Demographic informationg about the store such as the number of employees, annual sales and store type.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_Store_CustomerID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CustomerID</IndexField></IndexFields></Index><Index name="AK_Store_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_Store_SalesPersonID" clustered="No" unique="No"><IndexFields><IndexField>SalesPersonID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_Store_Customer_CustomerID" affectedField="CustomerID" sourceTable="Sales.Customer"/><InternalForeignKey name="FK_Store_SalesPerson_SalesPersonID" affectedField="SalesPersonID" sourceTable="Sales.SalesPerson"/></InternalForeignKeys><ExternalForeignKeys><ExternalForeignKey name="FK_StoreContact_Store_CustomerID" affectedSchema="" affectedTable="Sales.StoreContact" affectedField="CustomerID"/></ExternalForeignKeys><Triggers><Trigger name="iStore"><Text><Line text="CREATE TRIGGER [Sales].[iStore] ON [Sales].[Store] "/><Line text="AFTER INSERT AS "/><Line text="BEGIN"/><Line text="DECLARE @Count int;"/><Line text="SET @Count = @@ROWCOUNT;"/><Line text="IF @Count = 0 "/><Line text="RETURN;"/><Line text="SET NOCOUNT ON;"/><Line text="BEGIN TRY"/><Line text="IF EXISTS (SELECT * FROM inserted INNER JOIN [Sales].[Individual] "/><Line text="ON inserted.[CustomerID] = [Sales].[Individual].[CustomerID]) "/><Line text="BEGIN"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="END;"/><Line text="END TRY"/><Line text="BEGIN CATCH"/><Line text="EXECUTE [dbo].[uspPrintError];"/><Line text="IF @@TRANCOUNT &gt; 0"/><Line text="BEGIN"/><Line text="ROLLBACK TRANSACTION;"/><Line text="END"/><Line text="EXECUTE [dbo].[uspLogError];"/><Line text="END CATCH;"/><Line text="END;"/></Text></Trigger></Triggers></Table><Table name="Sales.StoreContact" file="AdventureWorks_201011112041_Sales.StoreContact.html"><Descriptions><Description type="" text="Cross-reference table mapping stores and their employees."/></Descriptions><PrimaryKeys><KeyField>CustomerID</KeyField><KeyField>ContactID</KeyField></PrimaryKeys><Fields><Field name="CustomerID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Store identification number. Foreign key to Customer.CustomerID.</Line></Comment></Comments></Field><Field name="ContactID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Contact (store employee) identification number. Foreign key to Contact.ContactID.</Line></Comment></Comments></Field><Field name="ContactTypeID" type="int" defaults="" nullable="No"><Comments><Comment type="Description"><Line>Contact type such as owner or purchasing agent. Foreign key to ContactType.ContactTypeID.</Line></Comment></Comments></Field><Field name="rowguid" type="uniqueidentifier" defaults="(newid())" nullable="No"><Comments><Comment type="Description"><Line>ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.</Line></Comment></Comments></Field><Field name="ModifiedDate" type="datetime" defaults="(getdate())" nullable="No"><Comments><Comment type="Description"><Line>Date and time the record was last updated.</Line></Comment></Comments></Field></Fields><Indexes><Index name="PK_StoreContact_CustomerID_ContactID" clustered="Yes" unique="Yes"><IndexFields><IndexField>CustomerID</IndexField><IndexField>ContactID</IndexField></IndexFields></Index><Index name="AK_StoreContact_rowguid" clustered="No" unique="Yes"><IndexFields><IndexField>rowguid</IndexField></IndexFields></Index><Index name="IX_StoreContact_ContactID" clustered="No" unique="No"><IndexFields><IndexField>ContactID</IndexField></IndexFields></Index><Index name="IX_StoreContact_ContactTypeID" clustered="No" unique="No"><IndexFields><IndexField>ContactTypeID</IndexField></IndexFields></Index></Indexes><CheckConstraints/><InternalForeignKeys><InternalForeignKey name="FK_StoreContact_Contact_ContactID" affectedField="ContactID" sourceTable="Person.Contact"/><InternalForeignKey name="FK_StoreContact_ContactType_ContactTypeID" affectedField="ContactTypeID" sourceTable="Person.ContactType"/><InternalForeignKey name="FK_StoreContact_Store_CustomerID" affectedField="CustomerID" sourceTable="Sales.Store"/></InternalForeignKeys><ExternalForeignKeys/><Triggers/></Table></Tables></Group><Group name="v" type="Views"><Views><View name="Person.vAdditionalContactInfo" file="AdventureWorks_201011112048_Person.vAdditionalContactInfo.html"><Descriptions><Description type="" text="Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person."/></Descriptions><Fields><Field name="ContactID" type="int" default="" nullable="No"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="TelephoneNumber" type="nvarchar (50)" default="" nullable="Yes"/><Field name="TelephoneSpecialInstructions" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Street" type="nvarchar (50)" default="" nullable="Yes"/><Field name="City" type="nvarchar (50)" default="" nullable="Yes"/><Field name="StateProvince" type="nvarchar (50)" default="" nullable="Yes"/><Field name="PostalCode" type="nvarchar (50)" default="" nullable="Yes"/><Field name="CountryRegion" type="nvarchar (50)" default="" nullable="Yes"/><Field name="HomeAddressSpecialInstructions" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="EMailAddress" type="nvarchar (128)" default="" nullable="Yes"/><Field name="EMailSpecialInstructions" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="EMailTelephoneNumber" type="nvarchar (50)" default="" nullable="Yes"/><Field name="rowguid" type="uniqueidentifier" default="" nullable="No"/><Field name="ModifiedDate" type="datetime" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Person].[vAdditionalContactInfo] </Line><Line>AS </Line><Line>SELECT </Line><Line>[ContactID] </Line><Line>,[FirstName]</Line><Line>,[MiddleName]</Line><Line>,[LastName]</Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:telephoneNumber)[1]/act:number', 'nvarchar(50)') AS [TelephoneNumber] </Line><Line>,LTRIM(RTRIM([ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:telephoneNumber/act:SpecialInstructions/text())[1]', 'nvarchar(max)'))) AS [TelephoneSpecialInstructions] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";</Line><Line>(act:homePostalAddress/act:Street)[1]', 'nvarchar(50)') AS [Street] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:homePostalAddress/act:City)[1]', 'nvarchar(50)') AS [City] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:homePostalAddress/act:StateProvince)[1]', 'nvarchar(50)') AS [StateProvince] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:homePostalAddress/act:PostalCode)[1]', 'nvarchar(50)') AS [PostalCode] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:homePostalAddress/act:CountryRegion)[1]', 'nvarchar(50)') AS [CountryRegion] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:homePostalAddress/act:SpecialInstructions/text())[1]', 'nvarchar(max)') AS [HomeAddressSpecialInstructions] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:eMail/act:eMailAddress)[1]', 'nvarchar(128)') AS [EMailAddress] </Line><Line>,LTRIM(RTRIM([ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:eMail/act:SpecialInstructions/text())[1]', 'nvarchar(max)'))) AS [EMailSpecialInstructions] </Line><Line>,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; </Line><Line>(act:eMail/act:SpecialInstructions/act:telephoneNumber/act:number)[1]', 'nvarchar(50)') AS [EMailTelephoneNumber] </Line><Line>,[rowguid] </Line><Line>,[ModifiedDate]</Line><Line>FROM [Person].[Contact]</Line><Line>OUTER APPLY [AdditionalContactInfo].nodes(</Line><Line>'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; </Line><Line>/ci:AdditionalContactInfo') AS ContactInfo(ref) </Line><Line>WHERE [AdditionalContactInfo] IS NOT NULL;</Line></Text></View><View name="HumanResources.vEmployee" file="AdventureWorks_201011112048_HumanResources.vEmployee.html"><Descriptions><Description type="" text="Employee names and addresses."/></Descriptions><Fields><Field name="EmployeeID" type="int" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="JobTitle" type="nvarchar (50)" default="" nullable="No"/><Field name="Phone" type="nvarchar (25)" default="" nullable="Yes"/><Field name="EmailAddress" type="nvarchar (50)" default="" nullable="Yes"/><Field name="EmailPromotion" type="int" default="" nullable="No"/><Field name="AddressLine1" type="nvarchar (60)" default="" nullable="No"/><Field name="AddressLine2" type="nvarchar (60)" default="" nullable="Yes"/><Field name="City" type="nvarchar (30)" default="" nullable="No"/><Field name="StateProvinceName" type="nvarchar (50)" default="" nullable="No"/><Field name="PostalCode" type="nvarchar (15)" default="" nullable="No"/><Field name="CountryRegionName" type="nvarchar (50)" default="" nullable="No"/><Field name="AdditionalContactInfo" type="xml" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [HumanResources].[vEmployee] </Line><Line>AS </Line><Line>SELECT </Line><Line>e.[EmployeeID]</Line><Line>,c.[Title]</Line><Line>,c.[FirstName]</Line><Line>,c.[MiddleName]</Line><Line>,c.[LastName]</Line><Line>,c.[Suffix]</Line><Line>,e.[Title] AS [JobTitle] </Line><Line>,c.[Phone]</Line><Line>,c.[EmailAddress]</Line><Line>,c.[EmailPromotion]</Line><Line>,a.[AddressLine1]</Line><Line>,a.[AddressLine2]</Line><Line>,a.[City]</Line><Line>,sp.[Name] AS [StateProvinceName] </Line><Line>,a.[PostalCode]</Line><Line>,cr.[Name] AS [CountryRegionName] </Line><Line>,c.[AdditionalContactInfo]</Line><Line>FROM [HumanResources].[Employee] e</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = e.[ContactID]</Line><Line>INNER JOIN [HumanResources].[EmployeeAddress] ea </Line><Line>ON e.[EmployeeID] = ea.[EmployeeID] </Line><Line>INNER JOIN [Person].[Address] a </Line><Line>ON ea.[AddressID] = a.[AddressID]</Line><Line>INNER JOIN [Person].[StateProvince] sp </Line><Line>ON sp.[StateProvinceID] = a.[StateProvinceID]</Line><Line>INNER JOIN [Person].[CountryRegion] cr </Line><Line>ON cr.[CountryRegionCode] = sp.[CountryRegionCode];</Line></Text></View><View name="HumanResources.vEmployeeDepartment" file="AdventureWorks_201011112048_HumanResources.vEmployeeDepartment.html"><Descriptions><Description type="" text="Returns employee name, title, and current department."/></Descriptions><Fields><Field name="EmployeeID" type="int" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="JobTitle" type="nvarchar (50)" default="" nullable="No"/><Field name="Department" type="nvarchar (50)" default="" nullable="No"/><Field name="GroupName" type="nvarchar (50)" default="" nullable="No"/><Field name="StartDate" type="datetime" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [HumanResources].[vEmployeeDepartment] </Line><Line>AS </Line><Line>SELECT </Line><Line>e.[EmployeeID] </Line><Line>,c.[Title] </Line><Line>,c.[FirstName] </Line><Line>,c.[MiddleName] </Line><Line>,c.[LastName] </Line><Line>,c.[Suffix] </Line><Line>,e.[Title] AS [JobTitle] </Line><Line>,d.[Name] AS [Department] </Line><Line>,d.[GroupName] </Line><Line>,edh.[StartDate] </Line><Line>FROM [HumanResources].[Employee] e</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = e.[ContactID]</Line><Line>INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh </Line><Line>ON e.[EmployeeID] = edh.[EmployeeID] </Line><Line>INNER JOIN [HumanResources].[Department] d </Line><Line>ON edh.[DepartmentID] = d.[DepartmentID] </Line><Line>WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());</Line></Text></View><View name="HumanResources.vEmployeeDepartmentHistory" file="AdventureWorks_201011112048_HumanResources.vEmployeeDepartmentHistory.html"><Descriptions><Description type="" text="Returns employee name and current and previous departments."/></Descriptions><Fields><Field name="EmployeeID" type="int" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="Shift" type="nvarchar (50)" default="" nullable="No"/><Field name="Department" type="nvarchar (50)" default="" nullable="No"/><Field name="GroupName" type="nvarchar (50)" default="" nullable="No"/><Field name="StartDate" type="datetime" default="" nullable="No"/><Field name="EndDate" type="datetime" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory] </Line><Line>AS </Line><Line>SELECT </Line><Line>e.[EmployeeID] </Line><Line>,c.[Title] </Line><Line>,c.[FirstName] </Line><Line>,c.[MiddleName] </Line><Line>,c.[LastName] </Line><Line>,c.[Suffix] </Line><Line>,s.[Name] AS [Shift]</Line><Line>,d.[Name] AS [Department] </Line><Line>,d.[GroupName] </Line><Line>,edh.[StartDate] </Line><Line>,edh.[EndDate]</Line><Line>FROM [HumanResources].[Employee] e</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = e.[ContactID]</Line><Line>INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh </Line><Line>ON e.[EmployeeID] = edh.[EmployeeID] </Line><Line>INNER JOIN [HumanResources].[Department] d </Line><Line>ON edh.[DepartmentID] = d.[DepartmentID] </Line><Line>INNER JOIN [HumanResources].[Shift] s</Line><Line>ON s.[ShiftID] = edh.[ShiftID];</Line></Text></View><View name="Sales.vIndividualCustomer" file="AdventureWorks_201011112048_Sales.vIndividualCustomer.html"><Descriptions><Description type="" text="Individual customers (names and addresses) that purchase Adventure Works Cycles products online."/></Descriptions><Fields><Field name="CustomerID" type="int" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="Phone" type="nvarchar (25)" default="" nullable="Yes"/><Field name="EmailAddress" type="nvarchar (50)" default="" nullable="Yes"/><Field name="EmailPromotion" type="int" default="" nullable="No"/><Field name="AddressType" type="nvarchar (50)" default="" nullable="No"/><Field name="AddressLine1" type="nvarchar (60)" default="" nullable="No"/><Field name="AddressLine2" type="nvarchar (60)" default="" nullable="Yes"/><Field name="City" type="nvarchar (30)" default="" nullable="No"/><Field name="StateProvinceName" type="nvarchar (50)" default="" nullable="No"/><Field name="PostalCode" type="nvarchar (15)" default="" nullable="No"/><Field name="CountryRegionName" type="nvarchar (50)" default="" nullable="No"/><Field name="Demographics" type="xml" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [Sales].[vIndividualCustomer] </Line><Line>AS </Line><Line>SELECT </Line><Line>i.[CustomerID]</Line><Line>,c.[Title]</Line><Line>,c.[FirstName]</Line><Line>,c.[MiddleName]</Line><Line>,c.[LastName]</Line><Line>,c.[Suffix]</Line><Line>,c.[Phone]</Line><Line>,c.[EmailAddress]</Line><Line>,c.[EmailPromotion]</Line><Line>,at.[Name] AS [AddressType]</Line><Line>,a.[AddressLine1]</Line><Line>,a.[AddressLine2]</Line><Line>,a.[City]</Line><Line>,[StateProvinceName] = sp.[Name]</Line><Line>,a.[PostalCode]</Line><Line>,[CountryRegionName] = cr.[Name]</Line><Line>,i.[Demographics]</Line><Line>FROM [Sales].[Individual] i</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = i.[ContactID]</Line><Line>INNER JOIN [Sales].[CustomerAddress] ca </Line><Line>ON ca.[CustomerID] = i.[CustomerID]</Line><Line>INNER JOIN [Person].[Address] a </Line><Line>ON a.[AddressID] = ca.[AddressID]</Line><Line>INNER JOIN [Person].[StateProvince] sp </Line><Line>ON sp.[StateProvinceID] = a.[StateProvinceID]</Line><Line>INNER JOIN [Person].[CountryRegion] cr </Line><Line>ON cr.[CountryRegionCode] = sp.[CountryRegionCode]</Line><Line>INNER JOIN [Person].[AddressType] at </Line><Line>ON ca.[AddressTypeID] = at.[AddressTypeID]</Line><Line>WHERE i.[CustomerID] IN (SELECT [Sales].[Customer].[CustomerID] </Line><Line>FROM [Sales].[Customer] WHERE UPPER([Sales].[Customer].[CustomerType]) = 'I');</Line></Text></View><View name="Sales.vIndividualDemographics" file="AdventureWorks_201011112048_Sales.vIndividualDemographics.html"><Descriptions><Description type="" text="Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table."/></Descriptions><Fields><Field name="CustomerID" type="int" default="" nullable="No"/><Field name="TotalPurchaseYTD" type="money" default="" nullable="Yes"/><Field name="DateFirstPurchase" type="datetime" default="" nullable="Yes"/><Field name="BirthDate" type="datetime" default="" nullable="Yes"/><Field name="MaritalStatus" type="nvarchar (1)" default="" nullable="Yes"/><Field name="YearlyIncome" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Gender" type="nvarchar (1)" default="" nullable="Yes"/><Field name="TotalChildren" type="int" default="" nullable="Yes"/><Field name="NumberChildrenAtHome" type="int" default="" nullable="Yes"/><Field name="Education" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Occupation" type="nvarchar (30)" default="" nullable="Yes"/><Field name="HomeOwnerFlag" type="bit" default="" nullable="Yes"/><Field name="NumberCarsOwned" type="int" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [Sales].[vIndividualDemographics] </Line><Line>AS </Line><Line>SELECT </Line><Line>i.[CustomerID] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>TotalPurchaseYTD[1]', 'money') AS [TotalPurchaseYTD] </Line><Line>,CONVERT(datetime, REPLACE([IndividualSurvey].[ref].[value](N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey"; </Line><Line>DateFirstPurchase[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [DateFirstPurchase] </Line><Line>,CONVERT(datetime, REPLACE([IndividualSurvey].[ref].[value](N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey"; </Line><Line>BirthDate[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [BirthDate] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>MaritalStatus[1]', 'nvarchar(1)') AS [MaritalStatus] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>YearlyIncome[1]', 'nvarchar(30)') AS [YearlyIncome] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>Gender[1]', 'nvarchar(1)') AS [Gender] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>TotalChildren[1]', 'integer') AS [TotalChildren] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>NumberChildrenAtHome[1]', 'integer') AS [NumberChildrenAtHome] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>Education[1]', 'nvarchar(30)') AS [Education] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>Occupation[1]', 'nvarchar(30)') AS [Occupation] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>HomeOwnerFlag[1]', 'bit') AS [HomeOwnerFlag] </Line><Line>,[IndividualSurvey].[ref].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/IndividualSurvey"; </Line><Line>NumberCarsOwned[1]', 'integer') AS [NumberCarsOwned] </Line><Line>FROM [Sales].[Individual] i </Line><Line>CROSS APPLY i.[Demographics].nodes(N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey"; </Line><Line>/IndividualSurvey') AS [IndividualSurvey](ref) </Line><Line>WHERE [Demographics] IS NOT NULL;</Line></Text></View><View name="HumanResources.vJobCandidate" file="AdventureWorks_201011112048_HumanResources.vJobCandidate.html"><Descriptions><Description type="" text="Job candidate names and resumes."/></Descriptions><Fields><Field name="JobCandidateID" type="int" default="" nullable="No"/><Field name="EmployeeID" type="int" default="" nullable="Yes"/><Field name="Name.Prefix" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Name.First" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Name.Middle" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Name.Last" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Name.Suffix" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Skills" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Addr.Type" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Addr.Loc.CountryRegion" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Addr.Loc.State" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Addr.Loc.City" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Addr.PostalCode" type="nvarchar (20)" default="" nullable="Yes"/><Field name="EMail" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="WebSite" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="ModifiedDate" type="datetime" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [HumanResources].[vJobCandidate] </Line><Line>AS </Line><Line>SELECT </Line><Line>jc.[JobCandidateID] </Line><Line>,jc.[EmployeeID] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/Name/Name.Prefix)[1]', 'nvarchar(30)') AS [Name.Prefix] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";</Line><Line>(/Resume/Name/Name.First)[1]', 'nvarchar(30)') AS [Name.First] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/Name/Name.Middle)[1]', 'nvarchar(30)') AS [Name.Middle] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/Name/Name.Last)[1]', 'nvarchar(30)') AS [Name.Last] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/Name/Name.Suffix)[1]', 'nvarchar(30)') AS [Name.Suffix] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/Skills)[1]', 'nvarchar(max)') AS [Skills] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Address/Addr.Type)[1]', 'nvarchar(30)') AS [Addr.Type]</Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Address/Addr.Location/Location/Loc.CountryRegion)[1]', 'nvarchar(100)') AS [Addr.Loc.CountryRegion]</Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Address/Addr.Location/Location/Loc.State)[1]', 'nvarchar(100)') AS [Addr.Loc.State]</Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Address/Addr.Location/Location/Loc.City)[1]', 'nvarchar(100)') AS [Addr.Loc.City]</Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Address/Addr.PostalCode)[1]', 'nvarchar(20)') AS [Addr.PostalCode]</Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/EMail)[1]', 'nvarchar(max)') AS [EMail] </Line><Line>,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(/Resume/WebSite)[1]', 'nvarchar(max)') AS [WebSite] </Line><Line>,jc.[ModifiedDate] </Line><Line>FROM [HumanResources].[JobCandidate] jc </Line><Line>CROSS APPLY jc.[Resume].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure</Line><Line>-works/Resume"; </Line><Line>/Resume') AS Resume(ref);</Line></Text></View><View name="HumanResources.vJobCandidateEducation" file="AdventureWorks_201011112048_HumanResources.vJobCandidateEducation.html"><Descriptions><Description type="" text="Displays the content from each education related element in the xml column Resume in the HumanResources.JobCandidate table. The content has been localized into French, Simplified Chinese and Thai. Some data may not display correctly unless supplemental language support is installed."/></Descriptions><Fields><Field name="JobCandidateID" type="int" default="" nullable="No"/><Field name="Edu.Level" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Edu.StartDate" type="datetime" default="" nullable="Yes"/><Field name="Edu.EndDate" type="datetime" default="" nullable="Yes"/><Field name="Edu.Degree" type="nvarchar (50)" default="" nullable="Yes"/><Field name="Edu.Major" type="nvarchar (50)" default="" nullable="Yes"/><Field name="Edu.Minor" type="nvarchar (50)" default="" nullable="Yes"/><Field name="Edu.GPA" type="nvarchar (5)" default="" nullable="Yes"/><Field name="Edu.GPAScale" type="nvarchar (5)" default="" nullable="Yes"/><Field name="Edu.School" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Edu.Loc.CountryRegion" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Edu.Loc.State" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Edu.Loc.City" type="nvarchar (100)" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [HumanResources].[vJobCandidateEducation] </Line><Line>AS </Line><Line>SELECT </Line><Line>jc.[JobCandidateID] </Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Level)[1]', 'nvarchar(max)') AS [Edu.Level]</Line><Line>,CONVERT(datetime, REPLACE([Education].ref.value(N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Edu.StartDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Edu.StartDate] </Line><Line>,CONVERT(datetime, REPLACE([Education].ref.value(N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Edu.EndDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Edu.EndDate] </Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Degree)[1]', 'nvarchar(50)') AS [Edu.Degree]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Major)[1]', 'nvarchar(50)') AS [Edu.Major]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Minor)[1]', 'nvarchar(50)') AS [Edu.Minor]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.GPA)[1]', 'nvarchar(5)') AS [Edu.GPA]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.GPAScale)[1]', 'nvarchar(5)') AS [Edu.GPAScale]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.School)[1]', 'nvarchar(100)') AS [Edu.School]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Location/Location/Loc.CountryRegion)[1]', 'nvarchar(100)') AS [Edu.Loc.CountryRegion]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Location/Location/Loc.State)[1]', 'nvarchar(100)') AS [Edu.Loc.State]</Line><Line>,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Edu.Location/Location/Loc.City)[1]', 'nvarchar(100)') AS [Edu.Loc.City]</Line><Line>FROM [HumanResources].[JobCandidate] jc </Line><Line>CROSS APPLY jc.[Resume].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure</Line><Line>-works/Resume"; </Line><Line>/Resume/Education') AS [Education](ref);</Line></Text></View><View name="HumanResources.vJobCandidateEmployment" file="AdventureWorks_201011112048_HumanResources.vJobCandidateEmployment.html"><Descriptions><Description type="" text="Displays the content from each employement history related element in the xml column Resume in the HumanResources.JobCandidate table. The content has been localized into French, Simplified Chinese and Thai. Some data may not display correctly unless supplemental language support is installed."/></Descriptions><Fields><Field name="JobCandidateID" type="int" default="" nullable="No"/><Field name="Emp.StartDate" type="datetime" default="" nullable="Yes"/><Field name="Emp.EndDate" type="datetime" default="" nullable="Yes"/><Field name="Emp.OrgName" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Emp.JobTitle" type="nvarchar (100)" default="" nullable="Yes"/><Field name="Emp.Responsibility" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Emp.FunctionCategory" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Emp.IndustryCategory" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Emp.Loc.CountryRegion" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Emp.Loc.State" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Emp.Loc.City" type="nvarchar (MAX)" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [HumanResources].[vJobCandidateEmployment] </Line><Line>AS </Line><Line>SELECT </Line><Line>jc.[JobCandidateID] </Line><Line>,CONVERT(datetime, REPLACE([Employment].ref.value(N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Emp.StartDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Emp.StartDate] </Line><Line>,CONVERT(datetime, REPLACE([Employment].ref.value(N'declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume"; </Line><Line>(Emp.EndDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Emp.EndDate] </Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.OrgName)[1]', 'nvarchar(100)') AS [Emp.OrgName]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.JobTitle)[1]', 'nvarchar(100)') AS [Emp.JobTitle]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.Responsibility)[1]', 'nvarchar(max)') AS [Emp.Responsibility]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.FunctionCategory)[1]', 'nvarchar(max)') AS [Emp.FunctionCategory]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.IndustryCategory)[1]', 'nvarchar(max)') AS [Emp.IndustryCategory]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.Location/Location/Loc.CountryRegion)[1]', 'nvarchar(max)') AS [Emp.Loc.CountryRegion]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.Location/Location/Loc.State)[1]', 'nvarchar(max)') AS [Emp.Loc.State]</Line><Line>,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/Resume"; </Line><Line>(Emp.Location/Location/Loc.City)[1]', 'nvarchar(max)') AS [Emp.Loc.City]</Line><Line>FROM [HumanResources].[JobCandidate] jc </Line><Line>CROSS APPLY jc.[Resume].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure</Line><Line>-works/Resume"; </Line><Line>/Resume/Employment') AS Employment(ref);</Line></Text></View><View name="Production.vProductAndDescription" file="AdventureWorks_201011112048_Production.vProductAndDescription.html"><Descriptions><Description type="" text="Product names and descriptions. Product descriptions are provided in multiple languages."/></Descriptions><Fields><Field name="ProductID" type="int" default="" nullable="No"/><Field name="Name" type="nvarchar (50)" default="" nullable="No"/><Field name="ProductModel" type="nvarchar (50)" default="" nullable="No"/><Field name="CultureID" type="nchar (6)" default="" nullable="No"/><Field name="Description" type="nvarchar (400)" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Production].[vProductAndDescription] </Line><Line>WITH SCHEMABINDING </Line><Line>AS </Line><Line>SELECT </Line><Line>p.[ProductID] </Line><Line>,p.[Name] </Line><Line>,pm.[Name] AS [ProductModel] </Line><Line>,pmx.[CultureID] </Line><Line>,pd.[Description] </Line><Line>FROM [Production].[Product] p </Line><Line>INNER JOIN [Production].[ProductModel] pm </Line><Line>ON p.[ProductModelID] = pm.[ProductModelID] </Line><Line>INNER JOIN [Production].[ProductModelProductDescriptionCulture] pmx </Line><Line>ON pm.[ProductModelID] = pmx.[ProductModelID] </Line><Line>INNER JOIN [Production].[ProductDescription] pd </Line><Line>ON pmx.[ProductDescriptionID] = pd.[ProductDescriptionID];</Line></Text></View><View name="Production.vProductModelCatalogDescription" file="AdventureWorks_201011112048_Production.vProductModelCatalogDescription.html"><Descriptions><Description type="" text="Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data."/></Descriptions><Fields><Field name="ProductModelID" type="int" default="" nullable="No"/><Field name="Name" type="nvarchar (50)" default="" nullable="No"/><Field name="Summary" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Manufacturer" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Copyright" type="nvarchar (30)" default="" nullable="Yes"/><Field name="ProductURL" type="nvarchar (256)" default="" nullable="Yes"/><Field name="WarrantyPeriod" type="nvarchar (256)" default="" nullable="Yes"/><Field name="WarrantyDescription" type="nvarchar (256)" default="" nullable="Yes"/><Field name="NoOfYears" type="nvarchar (256)" default="" nullable="Yes"/><Field name="MaintenanceDescription" type="nvarchar (256)" default="" nullable="Yes"/><Field name="Wheel" type="nvarchar (256)" default="" nullable="Yes"/><Field name="Saddle" type="nvarchar (256)" default="" nullable="Yes"/><Field name="Pedal" type="nvarchar (256)" default="" nullable="Yes"/><Field name="BikeFrame" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="Crankset" type="nvarchar (256)" default="" nullable="Yes"/><Field name="PictureAngle" type="nvarchar (256)" default="" nullable="Yes"/><Field name="PictureSize" type="nvarchar (256)" default="" nullable="Yes"/><Field name="ProductPhotoID" type="nvarchar (256)" default="" nullable="Yes"/><Field name="Material" type="nvarchar (256)" default="" nullable="Yes"/><Field name="Color" type="nvarchar (256)" default="" nullable="Yes"/><Field name="ProductLine" type="nvarchar (256)" default="" nullable="Yes"/><Field name="Style" type="nvarchar (256)" default="" nullable="Yes"/><Field name="RiderExperience" type="nvarchar (1024)" default="" nullable="Yes"/><Field name="rowguid" type="uniqueidentifier" default="" nullable="No"/><Field name="ModifiedDate" type="datetime" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Production].[vProductModelCatalogDescription] </Line><Line>AS </Line><Line>SELECT </Line><Line>[ProductModelID] </Line><Line>,[Name] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace html="http://www.w3.org/1999/xhtml"; </Line><Line>(/p1:ProductDescription/p1:Summary/html:p)[1]', 'nvarchar(max)') AS [Summary] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Manufacturer/p1:Name)[1]', 'nvarchar(max)') AS [Manufacturer] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Manufacturer/p1:Copyright)[1]', 'nvarchar(30)') AS [Copyright] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Manufacturer/p1:ProductURL)[1]', 'nvarchar(256)') AS [ProductURL] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain"; </Line><Line>(/p1:ProductDescription/p1:Features/wm:Warranty/wm:WarrantyPeriod)[1]', 'nvarchar(256)') AS [WarrantyPeriod] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain"; </Line><Line>(/p1:ProductDescription/p1:Features/wm:Warranty/wm:Description)[1]', 'nvarchar(256)') AS [WarrantyDescription] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain"; </Line><Line>(/p1:ProductDescription/p1:Features/wm:Maintenance/wm:NoOfYears)[1]', 'nvarchar(256)') AS [NoOfYears] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain"; </Line><Line>(/p1:ProductDescription/p1:Features/wm:Maintenance/wm:Description)[1]', 'nvarchar(256)') AS [MaintenanceDescription] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures"; </Line><Line>(/p1:ProductDescription/p1:Features/wf:wheel)[1]', 'nvarchar(256)') AS [Wheel] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures"; </Line><Line>(/p1:ProductDescription/p1:Features/wf:saddle)[1]', 'nvarchar(256)') AS [Saddle] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures"; </Line><Line>(/p1:ProductDescription/p1:Features/wf:pedal)[1]', 'nvarchar(256)') AS [Pedal] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures"; </Line><Line>(/p1:ProductDescription/p1:Features/wf:BikeFrame)[1]', 'nvarchar(max)') AS [BikeFrame] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>declare namespace wf="http://www.adventure-works.com/schemas/OtherFeature</Line><Line>s"; </Line><Line>(/p1:ProductDescription/p1:Features/wf:crankset)[1]', 'nvarchar(256)') AS [Crankset] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Picture/p1:Angle)[1]', 'nvarchar(256)') AS [PictureAngle] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Picture/p1:Size)[1]', 'nvarchar(256)') AS [PictureSize] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Picture/p1:ProductPhotoID)[1]', 'nvarchar(256)') AS [ProductPhotoID] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Specifications/Material)[1]', 'nvarchar(256)') AS [Material] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Specifications/Color)[1]', 'nvarchar(256)') AS [Color] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Specifications/ProductLine)[1]', 'nvarchar(256)') AS [ProductLine] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Specifications/Style)[1]', 'nvarchar(256)') AS [Style] </Line><Line>,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelDescription"; </Line><Line>(/p1:ProductDescription/p1:Specifications/RiderExperience)[1]', 'nvarchar(1024)') AS [RiderExperience] </Line><Line>,[rowguid] </Line><Line>,[ModifiedDate]</Line><Line>FROM [Production].[ProductModel] </Line><Line>WHERE [CatalogDescription] IS NOT NULL;</Line></Text></View><View name="Production.vProductModelInstructions" file="AdventureWorks_201011112048_Production.vProductModelInstructions.html"><Descriptions><Description type="" text="Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions."/></Descriptions><Fields><Field name="ProductModelID" type="int" default="" nullable="No"/><Field name="Name" type="nvarchar (50)" default="" nullable="No"/><Field name="Instructions" type="nvarchar (MAX)" default="" nullable="Yes"/><Field name="LocationID" type="int" default="" nullable="Yes"/><Field name="SetupHours" type="decimal (9, 4)" default="" nullable="Yes"/><Field name="MachineHours" type="decimal (9, 4)" default="" nullable="Yes"/><Field name="LaborHours" type="decimal (9, 4)" default="" nullable="Yes"/><Field name="LotSize" type="int" default="" nullable="Yes"/><Field name="Step" type="nvarchar (1024)" default="" nullable="Yes"/><Field name="rowguid" type="uniqueidentifier" default="" nullable="No"/><Field name="ModifiedDate" type="datetime" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Production].[vProductModelInstructions] </Line><Line>AS </Line><Line>SELECT </Line><Line>[ProductModelID] </Line><Line>,[Name] </Line><Line>,[Instructions].value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/ProductModelManuInstructions"; </Line><Line>(/root/text())[1]', 'nvarchar(max)') AS [Instructions] </Line><Line>,[MfgInstructions].ref.value('@LocationID[1]', 'int') AS [LocationID] </Line><Line>,[MfgInstructions].ref.value('@SetupHours[1]', 'decimal(9, 4)') AS [SetupHours] </Line><Line>,[MfgInstructions].ref.value('@MachineHours[1]', 'decimal(9, 4)') AS [MachineHours] </Line><Line>,[MfgInstructions].ref.value('@LaborHours[1]', 'decimal(9, 4)') AS [LaborHours] </Line><Line>,[MfgInstructions].ref.value('@LotSize[1]', 'int') AS [LotSize] </Line><Line>,[Steps].ref.value('string(.)[1]', 'nvarchar(1024)') AS [Step] </Line><Line>,[rowguid] </Line><Line>,[ModifiedDate]</Line><Line>FROM [Production].[ProductModel] </Line><Line>CROSS APPLY [Instructions].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure</Line><Line>-works/ProductModelManuInstructions"; </Line><Line>/root/Location') MfgInstructions(ref)</Line><Line>CROSS APPLY [MfgInstructions].ref.nodes('declare default element namespace </Line><Line>"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"; </Line><Line>step') Steps(ref);</Line></Text></View><View name="Sales.vSalesPerson" file="AdventureWorks_201011112048_Sales.vSalesPerson.html"><Descriptions><Description type="" text="Sales representiatives (names and addresses) and their sales-related information."/></Descriptions><Fields><Field name="SalesPersonID" type="int" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="JobTitle" type="nvarchar (50)" default="" nullable="No"/><Field name="Phone" type="nvarchar (25)" default="" nullable="Yes"/><Field name="EmailAddress" type="nvarchar (50)" default="" nullable="Yes"/><Field name="EmailPromotion" type="int" default="" nullable="No"/><Field name="AddressLine1" type="nvarchar (60)" default="" nullable="No"/><Field name="AddressLine2" type="nvarchar (60)" default="" nullable="Yes"/><Field name="City" type="nvarchar (30)" default="" nullable="No"/><Field name="StateProvinceName" type="nvarchar (50)" default="" nullable="No"/><Field name="PostalCode" type="nvarchar (15)" default="" nullable="No"/><Field name="CountryRegionName" type="nvarchar (50)" default="" nullable="No"/><Field name="TerritoryName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="TerritoryGroup" type="nvarchar (50)" default="" nullable="Yes"/><Field name="SalesQuota" type="money" default="" nullable="Yes"/><Field name="SalesYTD" type="money" default="" nullable="No"/><Field name="SalesLastYear" type="money" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Sales].[vSalesPerson] </Line><Line>AS </Line><Line>SELECT </Line><Line>s.[SalesPersonID]</Line><Line>,c.[Title]</Line><Line>,c.[FirstName]</Line><Line>,c.[MiddleName]</Line><Line>,c.[LastName]</Line><Line>,c.[Suffix]</Line><Line>,[JobTitle] = e.[Title]</Line><Line>,c.[Phone]</Line><Line>,c.[EmailAddress]</Line><Line>,c.[EmailPromotion]</Line><Line>,a.[AddressLine1]</Line><Line>,a.[AddressLine2]</Line><Line>,a.[City]</Line><Line>,[StateProvinceName] = sp.[Name]</Line><Line>,a.[PostalCode]</Line><Line>,[CountryRegionName] = cr.[Name]</Line><Line>,[TerritoryName] = st.[Name]</Line><Line>,[TerritoryGroup] = st.[Group]</Line><Line>,s.[SalesQuota]</Line><Line>,s.[SalesYTD]</Line><Line>,s.[SalesLastYear]</Line><Line>FROM [Sales].[SalesPerson] s</Line><Line>INNER JOIN [HumanResources].[Employee] e </Line><Line>ON e.[EmployeeID] = s.[SalesPersonID]</Line><Line>LEFT OUTER JOIN [Sales].[SalesTerritory] st </Line><Line>ON st.[TerritoryID] = s.[TerritoryID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = e.[ContactID]</Line><Line>INNER JOIN [HumanResources].[EmployeeAddress] ea </Line><Line>ON e.[EmployeeID] = ea.[EmployeeID] </Line><Line>INNER JOIN [Person].[Address] a </Line><Line>ON ea.[AddressID] = a.[AddressID]</Line><Line>INNER JOIN [Person].[StateProvince] sp </Line><Line>ON sp.[StateProvinceID] = a.[StateProvinceID]</Line><Line>INNER JOIN [Person].[CountryRegion] cr </Line><Line>ON cr.[CountryRegionCode] = sp.[CountryRegionCode];</Line></Text></View><View name="Sales.vSalesPersonSalesByFiscalYears" file="AdventureWorks_201011112048_Sales.vSalesPersonSalesByFiscalYears.html"><Descriptions><Description type="" text="Uses PIVOT to return aggregated sales information for each sales representative."/></Descriptions><Fields><Field name="SalesPersonID" type="int" default="" nullable="Yes"/><Field name="FullName" type="nvarchar (152)" default="" nullable="Yes"/><Field name="Title" type="nvarchar (50)" default="" nullable="No"/><Field name="SalesTerritory" type="nvarchar (50)" default="" nullable="No"/><Field name="2002" type="money" default="" nullable="Yes"/><Field name="2003" type="money" default="" nullable="Yes"/><Field name="2004" type="money" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [Sales].[vSalesPersonSalesByFiscalYears] </Line><Line>AS </Line><Line>SELECT </Line><Line>pvt.[SalesPersonID]</Line><Line>,pvt.[FullName]</Line><Line>,pvt.[Title]</Line><Line>,pvt.[SalesTerritory]</Line><Line>,pvt.[2002]</Line><Line>,pvt.[2003]</Line><Line>,pvt.[2004] </Line><Line>FROM (SELECT </Line><Line>soh.[SalesPersonID]</Line><Line>,c.[FirstName] + ' ' + COALESCE(c.[MiddleName], '') + ' ' + c.[LastName] AS [FullName]</Line><Line>,e.[Title]</Line><Line>,st.[Name] AS [SalesTerritory]</Line><Line>,soh.[SubTotal]</Line><Line>,YEAR(DATEADD(m, 6, soh.[OrderDate])) AS [FiscalYear] </Line><Line>FROM [Sales].[SalesPerson] sp </Line><Line>INNER JOIN [Sales].[SalesOrderHeader] soh </Line><Line>ON sp.[SalesPersonID] = soh.[SalesPersonID]</Line><Line>INNER JOIN [Sales].[SalesTerritory] st </Line><Line>ON sp.[TerritoryID] = st.[TerritoryID] </Line><Line>INNER JOIN [HumanResources].[Employee] e </Line><Line>ON soh.[SalesPersonID] = e.[EmployeeID] </Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.ContactID </Line><Line>) AS soh </Line><Line>PIVOT </Line><Line>(</Line><Line>SUM([SubTotal]) </Line><Line>FOR [FiscalYear] </Line><Line>IN ([2002], [2003], [2004])</Line><Line>) AS pvt;</Line></Text></View><View name="Person.vStateProvinceCountryRegion" file="AdventureWorks_201011112048_Person.vStateProvinceCountryRegion.html"><Descriptions><Description type="" text="Joins StateProvince table with CountryRegion table."/></Descriptions><Fields><Field name="StateProvinceID" type="int" default="" nullable="No"/><Field name="StateProvinceCode" type="nchar (3)" default="" nullable="No"/><Field name="IsOnlyStateProvinceFlag" type="bit" default="" nullable="No"/><Field name="StateProvinceName" type="nvarchar (50)" default="" nullable="No"/><Field name="TerritoryID" type="int" default="" nullable="No"/><Field name="CountryRegionCode" type="nvarchar (3)" default="" nullable="No"/><Field name="CountryRegionName" type="nvarchar (50)" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Person].[vStateProvinceCountryRegion] </Line><Line>WITH SCHEMABINDING </Line><Line>AS </Line><Line>SELECT </Line><Line>sp.[StateProvinceID] </Line><Line>,sp.[StateProvinceCode] </Line><Line>,sp.[IsOnlyStateProvinceFlag] </Line><Line>,sp.[Name] AS [StateProvinceName] </Line><Line>,sp.[TerritoryID] </Line><Line>,cr.[CountryRegionCode] </Line><Line>,cr.[Name] AS [CountryRegionName]</Line><Line>FROM [Person].[StateProvince] sp </Line><Line>INNER JOIN [Person].[CountryRegion] cr </Line><Line>ON sp.[CountryRegionCode] = cr.[CountryRegionCode];</Line></Text></View><View name="Sales.vStoreWithDemographics" file="AdventureWorks_201011112048_Sales.vStoreWithDemographics.html"><Descriptions><Description type="" text="Stores (names and addresses) that sell Adventure Works Cycles products to consumers."/></Descriptions><Fields><Field name="CustomerID" type="int" default="" nullable="No"/><Field name="Name" type="nvarchar (50)" default="" nullable="No"/><Field name="ContactType" type="nvarchar (50)" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="Phone" type="nvarchar (25)" default="" nullable="Yes"/><Field name="EmailAddress" type="nvarchar (50)" default="" nullable="Yes"/><Field name="EmailPromotion" type="int" default="" nullable="No"/><Field name="AddressType" type="nvarchar (50)" default="" nullable="No"/><Field name="AddressLine1" type="nvarchar (60)" default="" nullable="No"/><Field name="AddressLine2" type="nvarchar (60)" default="" nullable="Yes"/><Field name="City" type="nvarchar (30)" default="" nullable="No"/><Field name="StateProvinceName" type="nvarchar (50)" default="" nullable="No"/><Field name="PostalCode" type="nvarchar (15)" default="" nullable="No"/><Field name="CountryRegionName" type="nvarchar (50)" default="" nullable="No"/><Field name="AnnualSales" type="money" default="" nullable="Yes"/><Field name="AnnualRevenue" type="money" default="" nullable="Yes"/><Field name="BankName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="BusinessType" type="nvarchar (5)" default="" nullable="Yes"/><Field name="YearOpened" type="int" default="" nullable="Yes"/><Field name="Specialty" type="nvarchar (50)" default="" nullable="Yes"/><Field name="SquareFeet" type="int" default="" nullable="Yes"/><Field name="Brands" type="nvarchar (30)" default="" nullable="Yes"/><Field name="Internet" type="nvarchar (30)" default="" nullable="Yes"/><Field name="NumberEmployees" type="int" default="" nullable="Yes"/></Fields><Text><Line>CREATE VIEW [Sales].[vStoreWithDemographics] AS </Line><Line>SELECT </Line><Line>s.[CustomerID] </Line><Line>,s.[Name] </Line><Line>,ct.[Name] AS [ContactType] </Line><Line>,c.[Title] </Line><Line>,c.[FirstName] </Line><Line>,c.[MiddleName] </Line><Line>,c.[LastName] </Line><Line>,c.[Suffix] </Line><Line>,c.[Phone] </Line><Line>,c.[EmailAddress] </Line><Line>,c.[EmailPromotion] </Line><Line>,at.[Name] AS [AddressType]</Line><Line>,a.[AddressLine1] </Line><Line>,a.[AddressLine2] </Line><Line>,a.[City] </Line><Line>,sp.[Name] AS [StateProvinceName] </Line><Line>,a.[PostalCode] </Line><Line>,cr.[Name] AS [CountryRegionName] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/AnnualSales)[1]', 'money') AS [AnnualSales] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/AnnualRevenue)[1]', 'money') AS [AnnualRevenue] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/BankName)[1]', 'nvarchar(50)') AS [BankName] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/BusinessType)[1]', 'nvarchar(5)') AS [BusinessType] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/YearOpened)[1]', 'integer') AS [YearOpened] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/Specialty)[1]', 'nvarchar(50)') AS [Specialty] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/SquareFeet)[1]', 'integer') AS [SquareFeet] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/Brands)[1]', 'nvarchar(30)') AS [Brands] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/Internet)[1]', 'nvarchar(30)') AS [Internet] </Line><Line>,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-</Line><Line>works/StoreSurvey"; </Line><Line>(/StoreSurvey/NumberEmployees)[1]', 'integer') AS [NumberEmployees] </Line><Line>FROM [Sales].[Store] s</Line><Line>INNER JOIN [Sales].[StoreContact] sc </Line><Line>ON sc.[CustomerID] = s.[CustomerID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = sc.[ContactID]</Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON sc.[ContactTypeID] = ct.[ContactTypeID]</Line><Line>INNER JOIN [Sales].[CustomerAddress] ca </Line><Line>ON ca.[CustomerID] = s.[CustomerID]</Line><Line>INNER JOIN [Person].[Address] a </Line><Line>ON a.[AddressID] = ca.[AddressID]</Line><Line>INNER JOIN [Person].[StateProvince] sp </Line><Line>ON sp.[StateProvinceID] = a.[StateProvinceID]</Line><Line>INNER JOIN [Person].[CountryRegion] cr </Line><Line>ON cr.[CountryRegionCode] = sp.[CountryRegionCode]</Line><Line>INNER JOIN [Person].[AddressType] at </Line><Line>ON ca.[AddressTypeID] = at.[AddressTypeID]</Line><Line>WHERE s.[CustomerID] IN (SELECT [Sales].[Customer].[CustomerID] </Line><Line>FROM [Sales].[Customer] WHERE UPPER([Sales].[Customer].[CustomerType]) = 'S');</Line></Text></View><View name="Purchasing.vVendor" file="AdventureWorks_201011112048_Purchasing.vVendor.html"><Descriptions><Description type="" text="Vendor (company) names and addresses and the names of vendor employees to contact."/></Descriptions><Fields><Field name="VendorID" type="int" default="" nullable="No"/><Field name="Name" type="nvarchar (50)" default="" nullable="No"/><Field name="ContactType" type="nvarchar (50)" default="" nullable="No"/><Field name="Title" type="nvarchar (8)" default="" nullable="Yes"/><Field name="FirstName" type="nvarchar (50)" default="" nullable="No"/><Field name="MiddleName" type="nvarchar (50)" default="" nullable="Yes"/><Field name="LastName" type="nvarchar (50)" default="" nullable="No"/><Field name="Suffix" type="nvarchar (10)" default="" nullable="Yes"/><Field name="Phone" type="nvarchar (25)" default="" nullable="Yes"/><Field name="EmailAddress" type="nvarchar (50)" default="" nullable="Yes"/><Field name="EmailPromotion" type="int" default="" nullable="No"/><Field name="AddressLine1" type="nvarchar (60)" default="" nullable="No"/><Field name="AddressLine2" type="nvarchar (60)" default="" nullable="Yes"/><Field name="City" type="nvarchar (30)" default="" nullable="No"/><Field name="StateProvinceName" type="nvarchar (50)" default="" nullable="No"/><Field name="PostalCode" type="nvarchar (15)" default="" nullable="No"/><Field name="CountryRegionName" type="nvarchar (50)" default="" nullable="No"/></Fields><Text><Line>CREATE VIEW [Purchasing].[vVendor] AS </Line><Line>SELECT </Line><Line>v.[VendorID]</Line><Line>,v.[Name]</Line><Line>,ct.[Name] AS [ContactType]</Line><Line>,c.[Title]</Line><Line>,c.[FirstName]</Line><Line>,c.[MiddleName]</Line><Line>,c.[LastName]</Line><Line>,c.[Suffix]</Line><Line>,c.[Phone]</Line><Line>,c.[EmailAddress]</Line><Line>,c.[EmailPromotion]</Line><Line>,a.[AddressLine1]</Line><Line>,a.[AddressLine2]</Line><Line>,a.[City]</Line><Line>,[StateProvinceName] = sp.[Name]</Line><Line>,a.[PostalCode]</Line><Line>,[CountryRegionName] = cr.[Name]</Line><Line>FROM [Purchasing].[Vendor] v</Line><Line>INNER JOIN [Purchasing].[VendorContact] vc </Line><Line>ON vc.[VendorID] = v.[VendorID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON c.[ContactID] = vc.[ContactID]</Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON vc.[ContactTypeID] = ct.[ContactTypeID]</Line><Line>INNER JOIN [Purchasing].[VendorAddress] va </Line><Line>ON va.[VendorID] = v.[VendorID]</Line><Line>INNER JOIN [Person].[Address] a </Line><Line>ON a.[AddressID] = va.[AddressID]</Line><Line>INNER JOIN [Person].[StateProvince] sp </Line><Line>ON sp.[StateProvinceID] = a.[StateProvinceID]</Line><Line>INNER JOIN [Person].[CountryRegion] cr </Line><Line>ON cr.[CountryRegionCode] = sp.[CountryRegionCode];</Line></Text></View></Views></Group><Group name="sp" type="Stored Procedures"><StoredProcedures><StoredProcedure name="dbo.uspGetBillOfMaterials" file="AdventureWorks_201011112048_dbo.uspGetBillOfMaterials.html"><Parameters><Parameter name="@StartProductID" type="int" inout="IN"/><Parameter name="@CheckDate" type="datetime" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [dbo].[uspGetBillOfMaterials]</Line><Line>@StartProductID [int],</Line><Line>@CheckDate [datetime]</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], </Line><Line>[RecursionLevel]) -- CTE name and columns</Line><Line>AS (</Line><Line>SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get </Line><Line>the initial list of components for the bike assembly</Line><Line>FROM [Production].[BillOfMaterials] b</Line><Line>INNER JOIN [Production].[Product] p </Line><Line>ON b.[ComponentID] = p.[ProductID] </Line><Line>WHERE b.[ProductAssemblyID] = @StartProductID </Line><Line>AND @CheckDate &gt;= b.[StartDate] </Line><Line>AND @CheckDate &lt;= ISNULL(b.[EndDate], @CheckDate)</Line><Line>UNION ALL</Line><Line>SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], </Line><Line>[RecursionLevel] + 1 -- Join recursive member to anchor</Line><Line>FROM [BOM_cte] cte</Line><Line>INNER JOIN [Production].[BillOfMaterials] b </Line><Line>ON b.[ProductAssemblyID] = cte.[ComponentID]</Line><Line>INNER JOIN [Production].[Product] p </Line><Line>ON b.[ComponentID] = p.[ProductID] </Line><Line>WHERE @CheckDate &gt;= b.[StartDate] </Line><Line>AND @CheckDate &lt;= ISNULL(b.[EndDate], @CheckDate)</Line><Line>)</Line><Line>SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], </Line><Line>b.[ListPrice], b.[BOMLevel], b.[RecursionLevel]</Line><Line>FROM [BOM_cte] b</Line><Line>GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.</Line><Line>[ListPrice]</Line><Line>ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID]</Line><Line>OPTION (MAXRECURSION 25) </Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="dbo.uspGetEmployeeManagers" file="AdventureWorks_201011112048_dbo.uspGetEmployeeManagers.html"><Parameters><Parameter name="@EmployeeID" type="int" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [dbo].[uspGetEmployeeManagers]</Line><Line>@EmployeeID [int]</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>WITH [EMP_cte]([EmployeeID], [ManagerID], [FirstName], [LastName], [Title], [RecursionLevel]) -- CTE name and columns</Line><Line>AS (</Line><Line>SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], e.[Title], 0 -- Get the initial Employee</Line><Line>FROM [HumanResources].[Employee] e </Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.[ContactID]</Line><Line>WHERE e.[EmployeeID] = @EmployeeID</Line><Line>UNION ALL</Line><Line>SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], e.[Title], [RecursionLevel] + 1 -- Join recursive member to anchor</Line><Line>FROM [HumanResources].[Employee] e </Line><Line>INNER JOIN [EMP_cte]</Line><Line>ON e.[EmployeeID] = [EMP_cte].[ManagerID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.[ContactID]</Line><Line>)</Line><Line>SELECT [EMP_cte].[RecursionLevel], [EMP_cte].[EmployeeID], [EMP_cte].[FirstName], [EMP_cte].[LastName], </Line><Line>[EMP_cte].[ManagerID], c.[FirstName] AS 'ManagerFirstName', c.[LastName] AS 'ManagerLastName'  -- Outer select from the CTE</Line><Line>FROM [EMP_cte] </Line><Line>INNER JOIN [HumanResources].[Employee] e </Line><Line>ON [EMP_cte].[ManagerID] = e.[EmployeeID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.[ContactID]</Line><Line>ORDER BY [RecursionLevel], [ManagerID], [EmployeeID]</Line><Line>OPTION (MAXRECURSION 25) </Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="dbo.uspGetManagerEmployees" file="AdventureWorks_201011112048_dbo.uspGetManagerEmployees.html"><Parameters><Parameter name="@ManagerID" type="int" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [dbo].[uspGetManagerEmployees]</Line><Line>@ManagerID [int]</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>WITH [EMP_cte]([EmployeeID], [ManagerID], [FirstName], [LastName], [RecursionLevel]) -- CTE name and columns</Line><Line>AS (</Line><Line>SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], 0 -- Get the initial list of Employees for Manager n</Line><Line>FROM [HumanResources].[Employee] e </Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.[ContactID]</Line><Line>WHERE [ManagerID] = @ManagerID</Line><Line>UNION ALL</Line><Line>SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], [RecursionLevel] + 1 -- Join recursive member to anchor</Line><Line>FROM [HumanResources].[Employee] e </Line><Line>INNER JOIN [EMP_cte]</Line><Line>ON e.[ManagerID] = [EMP_cte].[EmployeeID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.[ContactID]</Line><Line>)</Line><Line>SELECT [EMP_cte].[RecursionLevel], [EMP_cte].[ManagerID], c.[FirstName] AS 'ManagerFirstName', c.[LastName] AS </Line><Line>'ManagerLastName',</Line><Line>[EMP_cte].[EmployeeID], [EMP_cte].[FirstName], [EMP_cte].[LastName] -- Outer select from the CTE</Line><Line>FROM [EMP_cte] </Line><Line>INNER JOIN [HumanResources].[Employee] e </Line><Line>ON [EMP_cte].[ManagerID] = e.[EmployeeID]</Line><Line>INNER JOIN [Person].[Contact] c </Line><Line>ON e.[ContactID] = c.[ContactID]</Line><Line>ORDER BY [RecursionLevel], [ManagerID], [EmployeeID]</Line><Line>OPTION (MAXRECURSION 25) </Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="dbo.uspGetWhereUsedProductID" file="AdventureWorks_201011112048_dbo.uspGetWhereUsedProductID.html"><Parameters><Parameter name="@StartProductID" type="int" inout="IN"/><Parameter name="@CheckDate" type="datetime" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [dbo].[uspGetWhereUsedProductID]</Line><Line>@StartProductID [int],</Line><Line>@CheckDate [datetime]</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], </Line><Line>[RecursionLevel]) -- CTE name and columns</Line><Line>AS (</Line><Line>SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get </Line><Line>the initial list of components for the bike assembly</Line><Line>FROM [Production].[BillOfMaterials] b</Line><Line>INNER JOIN [Production].[Product] p </Line><Line>ON b.[ProductAssemblyID] = p.[ProductID] </Line><Line>WHERE b.[ComponentID] = @StartProductID </Line><Line>AND @CheckDate &gt;= b.[StartDate] </Line><Line>AND @CheckDate &lt;= ISNULL(b.[EndDate], @CheckDate)</Line><Line>UNION ALL</Line><Line>SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], </Line><Line>[RecursionLevel] + 1 -- Join recursive member to anchor</Line><Line>FROM [BOM_cte] cte</Line><Line>INNER JOIN [Production].[BillOfMaterials] b </Line><Line>ON cte.[ProductAssemblyID] = b.[ComponentID]</Line><Line>INNER JOIN [Production].[Product] p </Line><Line>ON b.[ProductAssemblyID] = p.[ProductID] </Line><Line>WHERE @CheckDate &gt;= b.[StartDate] </Line><Line>AND @CheckDate &lt;= ISNULL(b.[EndDate], @CheckDate)</Line><Line>)</Line><Line>SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], </Line><Line>b.[ListPrice], b.[BOMLevel], b.[RecursionLevel]</Line><Line>FROM [BOM_cte] b</Line><Line>GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.</Line><Line>[ListPrice]</Line><Line>ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID]</Line><Line>OPTION (MAXRECURSION 25) </Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="dbo.uspLogError" file="AdventureWorks_201011112048_dbo.uspLogError.html"><Parameters><Parameter name="@ErrorLogID" type="int" inout="INOUT"/></Parameters><Text><Line>CREATE PROCEDURE [dbo].[uspLogError] </Line><Line>@ErrorLogID [int] = 0 OUTPUT -- contains the ErrorLogID of the row inserted</Line><Line>AS                               -- by uspLogError in the ErrorLog table</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>SET @ErrorLogID = 0;</Line><Line>BEGIN TRY</Line><Line>IF ERROR_NUMBER() IS NULL</Line><Line>RETURN;</Line><Line>IF XACT_STATE() = -1</Line><Line>BEGIN</Line><Line>PRINT 'Cannot log error since the current transaction is in an uncommittable state. ' </Line><Line>+ 'Rollback the transaction before executing uspLogError in order to successfully log error information.';</Line><Line>RETURN;</Line><Line>END</Line><Line>INSERT [dbo].[ErrorLog] </Line><Line>(</Line><Line>[UserName], </Line><Line>[ErrorNumber], </Line><Line>[ErrorSeverity], </Line><Line>[ErrorState], </Line><Line>[ErrorProcedure], </Line><Line>[ErrorLine], </Line><Line>[ErrorMessage]</Line><Line>) </Line><Line>VALUES </Line><Line>(</Line><Line>CONVERT(sysname, CURRENT_USER), </Line><Line>ERROR_NUMBER(),</Line><Line>ERROR_SEVERITY(),</Line><Line>ERROR_STATE(),</Line><Line>ERROR_PROCEDURE(),</Line><Line>ERROR_LINE(),</Line><Line>ERROR_MESSAGE()</Line><Line>);</Line><Line>SET @ErrorLogID = @@IDENTITY;</Line><Line>END TRY</Line><Line>BEGIN CATCH</Line><Line>PRINT 'An error occurred in stored procedure uspLogError: ';</Line><Line>EXECUTE [dbo].[uspPrintError];</Line><Line>RETURN -1;</Line><Line>END CATCH</Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="dbo.uspPrintError" file="AdventureWorks_201011112048_dbo.uspPrintError.html"><Parameters/><Text><Line>CREATE PROCEDURE [dbo].[uspPrintError] </Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>PRINT 'Error ' + CONVERT(varchar(50), ERROR_NUMBER()) +</Line><Line>', Severity ' + CONVERT(varchar(5), ERROR_SEVERITY()) +</Line><Line>', State ' + CONVERT(varchar(5), ERROR_STATE()) + </Line><Line>', Procedure ' + ISNULL(ERROR_PROCEDURE(), '-') + </Line><Line>', Line ' + CONVERT(varchar(5), ERROR_LINE());</Line><Line>PRINT ERROR_MESSAGE();</Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="HumanResources.uspUpdateEmployeeHireInfo" file="AdventureWorks_201011112048_HumanResources.uspUpdateEmployeeHireInfo.html"><Parameters><Parameter name="@EmployeeID" type="int" inout="IN"/><Parameter name="@Title" type="nvarchar (50)" inout="IN"/><Parameter name="@HireDate" type="datetime" inout="IN"/><Parameter name="@RateChangeDate" type="datetime" inout="IN"/><Parameter name="@Rate" type="money" inout="IN"/><Parameter name="@PayFrequency" type="tinyint" inout="IN"/><Parameter name="@CurrentFlag" type="bit" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeHireInfo]</Line><Line>@EmployeeID [int], </Line><Line>@Title [nvarchar](50), </Line><Line>@HireDate [datetime], </Line><Line>@RateChangeDate [datetime], </Line><Line>@Rate [money], </Line><Line>@PayFrequency [tinyint], </Line><Line>@CurrentFlag [dbo].[Flag] </Line><Line>WITH EXECUTE AS CALLER</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>BEGIN TRY</Line><Line>BEGIN TRANSACTION;</Line><Line>UPDATE [HumanResources].[Employee] </Line><Line>SET [Title] = @Title </Line><Line>,[HireDate] = @HireDate </Line><Line>,[CurrentFlag] = @CurrentFlag </Line><Line>WHERE [EmployeeID] = @EmployeeID;</Line><Line>INSERT INTO [HumanResources].[EmployeePayHistory] </Line><Line>([EmployeeID]</Line><Line>,[RateChangeDate]</Line><Line>,[Rate]</Line><Line>,[PayFrequency]) </Line><Line>VALUES (@EmployeeID, @RateChangeDate, @Rate, @PayFrequency);</Line><Line>COMMIT TRANSACTION;</Line><Line>END TRY</Line><Line>BEGIN CATCH</Line><Line>IF @@TRANCOUNT &gt; 0</Line><Line>BEGIN</Line><Line>ROLLBACK TRANSACTION;</Line><Line>END</Line><Line>EXECUTE [dbo].[uspLogError];</Line><Line>END CATCH;</Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="HumanResources.uspUpdateEmployeeLogin" file="AdventureWorks_201011112048_HumanResources.uspUpdateEmployeeLogin.html"><Parameters><Parameter name="@EmployeeID" type="int" inout="IN"/><Parameter name="@ManagerID" type="int" inout="IN"/><Parameter name="@LoginID" type="nvarchar (256)" inout="IN"/><Parameter name="@Title" type="nvarchar (50)" inout="IN"/><Parameter name="@HireDate" type="datetime" inout="IN"/><Parameter name="@CurrentFlag" type="bit" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeLogin]</Line><Line>@EmployeeID [int], </Line><Line>@ManagerID [int],</Line><Line>@LoginID [nvarchar](256),</Line><Line>@Title [nvarchar](50),</Line><Line>@HireDate [datetime],</Line><Line>@CurrentFlag [dbo].[Flag]</Line><Line>WITH EXECUTE AS CALLER</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>BEGIN TRY</Line><Line>UPDATE [HumanResources].[Employee] </Line><Line>SET [ManagerID] = @ManagerID </Line><Line>,[LoginID] = @LoginID </Line><Line>,[Title] = @Title </Line><Line>,[HireDate] = @HireDate </Line><Line>,[CurrentFlag] = @CurrentFlag </Line><Line>WHERE [EmployeeID] = @EmployeeID;</Line><Line>END TRY</Line><Line>BEGIN CATCH</Line><Line>EXECUTE [dbo].[uspLogError];</Line><Line>END CATCH;</Line><Line>END;</Line></Text></StoredProcedure><StoredProcedure name="HumanResources.uspUpdateEmployeePersonalInfo" file="AdventureWorks_201011112048_HumanResources.uspUpdateEmployeePersonalInfo.html"><Parameters><Parameter name="@EmployeeID" type="int" inout="IN"/><Parameter name="@NationalIDNumber" type="nvarchar (15)" inout="IN"/><Parameter name="@BirthDate" type="datetime" inout="IN"/><Parameter name="@MaritalStatus" type="nchar (1)" inout="IN"/><Parameter name="@Gender" type="nchar (1)" inout="IN"/></Parameters><Text><Line>CREATE PROCEDURE [HumanResources].[uspUpdateEmployeePersonalInfo]</Line><Line>@EmployeeID [int], </Line><Line>@NationalIDNumber [nvarchar](15), </Line><Line>@BirthDate [datetime], </Line><Line>@MaritalStatus [nchar](1), </Line><Line>@Gender [nchar](1)</Line><Line>WITH EXECUTE AS CALLER</Line><Line>AS</Line><Line>BEGIN</Line><Line>SET NOCOUNT ON;</Line><Line>BEGIN TRY</Line><Line>UPDATE [HumanResources].[Employee] </Line><Line>SET [NationalIDNumber] = @NationalIDNumber </Line><Line>,[BirthDate] = @BirthDate </Line><Line>,[MaritalStatus] = @MaritalStatus </Line><Line>,[Gender] = @Gender </Line><Line>WHERE [EmployeeID] = @EmployeeID;</Line><Line>END TRY</Line><Line>BEGIN CATCH</Line><Line>EXECUTE [dbo].[uspLogError];</Line><Line>END CATCH;</Line><Line>END;</Line></Text></StoredProcedure></StoredProcedures></Group><Group name="f" type="Functions"><Functions><Function name="dbo.ufnGetAccountingEndDate" file="AdventureWorks_201011112048_dbo.ufnGetAccountingEndDate.html" outputType="datetime"><Parameters/><Text><Line>CREATE FUNCTION [dbo].[ufnGetAccountingEndDate]()</Line><Line>RETURNS [datetime] </Line><Line>AS </Line><Line>BEGIN</Line><Line>RETURN DATEADD(millisecond, -2, CONVERT(datetime, '20040701', 112));</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetAccountingStartDate" file="AdventureWorks_201011112048_dbo.ufnGetAccountingStartDate.html" outputType="datetime"><Parameters/><Text><Line>CREATE FUNCTION [dbo].[ufnGetAccountingStartDate]()</Line><Line>RETURNS [datetime] </Line><Line>AS </Line><Line>BEGIN</Line><Line>RETURN CONVERT(datetime, '20030701', 112);</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetContactInformation" file="AdventureWorks_201011112048_dbo.ufnGetContactInformation.html" outputType="TABLE"><Parameters><Parameter name="@ContactID" type="int"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetContactInformation](@ContactID int)</Line><Line>RETURNS @retContactInformation TABLE </Line><Line>(</Line><Line>[ContactID] int PRIMARY KEY NOT NULL, </Line><Line>[FirstName] [nvarchar](50) NULL, </Line><Line>[LastName] [nvarchar](50) NULL, </Line><Line>[JobTitle] [nvarchar](50) NULL, </Line><Line>[ContactType] [nvarchar](50) NULL</Line><Line>)</Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE </Line><Line>@FirstName [nvarchar](50), </Line><Line>@LastName [nvarchar](50), </Line><Line>@JobTitle [nvarchar](50), </Line><Line>@ContactType [nvarchar](50);</Line><Line>SELECT </Line><Line>@ContactID = ContactID, </Line><Line>@FirstName = FirstName, </Line><Line>@LastName = LastName</Line><Line>FROM [Person].[Contact] </Line><Line>WHERE [ContactID] = @ContactID;</Line><Line>SET @JobTitle = </Line><Line>CASE </Line><Line>WHEN EXISTS(SELECT * FROM [HumanResources].[Employee] e </Line><Line>WHERE e.[ContactID] = @ContactID) </Line><Line>THEN (SELECT [Title] </Line><Line>FROM [HumanResources].[Employee] </Line><Line>WHERE [ContactID] = @ContactID)</Line><Line>WHEN EXISTS(SELECT * FROM [Purchasing].[VendorContact] vc </Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON vc.[ContactTypeID] = ct.[ContactTypeID] </Line><Line>WHERE vc.[ContactID] = @ContactID) </Line><Line>THEN (SELECT ct.[Name] </Line><Line>FROM [Purchasing].[VendorContact] vc </Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON vc.[ContactTypeID] = ct.[ContactTypeID] </Line><Line>WHERE vc.[ContactID] = @ContactID)</Line><Line>WHEN EXISTS(SELECT * FROM [Sales].[StoreContact] sc </Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON sc.[ContactTypeID] = ct.[ContactTypeID] </Line><Line>WHERE sc.[ContactID] = @ContactID) </Line><Line>THEN (SELECT ct.[Name] </Line><Line>FROM [Sales].[StoreContact] sc </Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON sc.[ContactTypeID] = ct.[ContactTypeID] </Line><Line>WHERE [ContactID] = @ContactID)</Line><Line>ELSE NULL </Line><Line>END;</Line><Line>SET @ContactType = </Line><Line>CASE </Line><Line>WHEN EXISTS(SELECT * FROM [HumanResources].[Employee] e </Line><Line>WHERE e.[ContactID] = @ContactID) </Line><Line>THEN 'Employee'</Line><Line>WHEN EXISTS(SELECT * FROM [Purchasing].[VendorContact] vc </Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON vc.[ContactTypeID] = ct.[ContactTypeID] </Line><Line>WHERE vc.[ContactID] = @ContactID) </Line><Line>THEN 'Vendor Contact'</Line><Line>WHEN EXISTS(SELECT * FROM [Sales].[StoreContact] sc </Line><Line>INNER JOIN [Person].[ContactType] ct </Line><Line>ON sc.[ContactTypeID] = ct.[ContactTypeID] </Line><Line>WHERE sc.[ContactID] = @ContactID) </Line><Line>THEN 'Store Contact'</Line><Line>WHEN EXISTS(SELECT * FROM [Sales].[Individual] i </Line><Line>WHERE i.[ContactID] = @ContactID) </Line><Line>THEN 'Consumer'</Line><Line>END;</Line><Line>IF @ContactID IS NOT NULL </Line><Line>BEGIN</Line><Line>INSERT @retContactInformation</Line><Line>SELECT @ContactID, @FirstName, @LastName, @JobTitle, @ContactType;</Line><Line>END;</Line><Line>RETURN;</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetDocumentStatusText" file="AdventureWorks_201011112048_dbo.ufnGetDocumentStatusText.html" outputType="nvarchar (16)"><Parameters><Parameter name="@Status" type="tinyint"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetDocumentStatusText](@Status [tinyint])</Line><Line>RETURNS [nvarchar](16) </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @ret [nvarchar](16);</Line><Line>SET @ret = </Line><Line>CASE @Status</Line><Line>WHEN 1 THEN N'Pending approval'</Line><Line>WHEN 2 THEN N'Approved'</Line><Line>WHEN 3 THEN N'Obsolete'</Line><Line>ELSE N'** Invalid **'</Line><Line>END;</Line><Line></Line><Line>RETURN @ret</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetProductDealerPrice" file="AdventureWorks_201011112048_dbo.ufnGetProductDealerPrice.html" outputType="money"><Parameters><Parameter name="@ProductID" type="int"/><Parameter name="@OrderDate" type="datetime"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetProductDealerPrice](@ProductID [int], @OrderDate [datetime])</Line><Line>RETURNS [money] </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @DealerPrice money;</Line><Line>DECLARE @DealerDiscount money;</Line><Line>SET @DealerDiscount = 0.60  -- 60% of list price</Line><Line>SELECT @DealerPrice = plph.[ListPrice] * @DealerDiscount </Line><Line>FROM [Production].[Product] p </Line><Line>INNER JOIN [Production].[ProductListPriceHistory] plph </Line><Line>ON p.[ProductID] = plph.[ProductID] </Line><Line>AND p.[ProductID] = @ProductID </Line><Line>AND @OrderDate BETWEEN plph.[StartDate] AND COALESCE(plph.[EndDate], CONVERT(datetime, '99991231', 112)); -- Make sure we </Line><Line>get all the prices!</Line><Line>RETURN @DealerPrice;</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetProductListPrice" file="AdventureWorks_201011112048_dbo.ufnGetProductListPrice.html" outputType="money"><Parameters><Parameter name="@ProductID" type="int"/><Parameter name="@OrderDate" type="datetime"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetProductListPrice](@ProductID [int], @OrderDate [datetime])</Line><Line>RETURNS [money] </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @ListPrice money;</Line><Line>SELECT @ListPrice = plph.[ListPrice] </Line><Line>FROM [Production].[Product] p </Line><Line>INNER JOIN [Production].[ProductListPriceHistory] plph </Line><Line>ON p.[ProductID] = plph.[ProductID] </Line><Line>AND p.[ProductID] = @ProductID </Line><Line>AND @OrderDate BETWEEN plph.[StartDate] AND COALESCE(plph.[EndDate], CONVERT(datetime, '99991231', 112)); -- Make sure we </Line><Line>get all the prices!</Line><Line>RETURN @ListPrice;</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetProductStandardCost" file="AdventureWorks_201011112048_dbo.ufnGetProductStandardCost.html" outputType="money"><Parameters><Parameter name="@ProductID" type="int"/><Parameter name="@OrderDate" type="datetime"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetProductStandardCost](@ProductID [int], @OrderDate [datetime])</Line><Line>RETURNS [money] </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @StandardCost money;</Line><Line>SELECT @StandardCost = pch.[StandardCost] </Line><Line>FROM [Production].[Product] p </Line><Line>INNER JOIN [Production].[ProductCostHistory] pch </Line><Line>ON p.[ProductID] = pch.[ProductID] </Line><Line>AND p.[ProductID] = @ProductID </Line><Line>AND @OrderDate BETWEEN pch.[StartDate] AND COALESCE(pch.[EndDate], CONVERT(datetime, '99991231', 112)); -- Make sure we </Line><Line>get all the prices!</Line><Line>RETURN @StandardCost;</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetPurchaseOrderStatusText" file="AdventureWorks_201011112048_dbo.ufnGetPurchaseOrderStatusText.html" outputType="nvarchar (15)"><Parameters><Parameter name="@Status" type="tinyint"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetPurchaseOrderStatusText](@Status [tinyint])</Line><Line>RETURNS [nvarchar](15) </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @ret [nvarchar](15);</Line><Line>SET @ret = </Line><Line>CASE @Status</Line><Line>WHEN 1 THEN 'Pending'</Line><Line>WHEN 2 THEN 'Approved'</Line><Line>WHEN 3 THEN 'Rejected'</Line><Line>WHEN 4 THEN 'Complete'</Line><Line>ELSE '** Invalid **'</Line><Line>END;</Line><Line></Line><Line>RETURN @ret</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetSalesOrderStatusText" file="AdventureWorks_201011112048_dbo.ufnGetSalesOrderStatusText.html" outputType="nvarchar (15)"><Parameters><Parameter name="@Status" type="tinyint"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetSalesOrderStatusText](@Status [tinyint])</Line><Line>RETURNS [nvarchar](15) </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @ret [nvarchar](15);</Line><Line>SET @ret = </Line><Line>CASE @Status</Line><Line>WHEN 1 THEN 'In process'</Line><Line>WHEN 2 THEN 'Approved'</Line><Line>WHEN 3 THEN 'Backordered'</Line><Line>WHEN 4 THEN 'Rejected'</Line><Line>WHEN 5 THEN 'Shipped'</Line><Line>WHEN 6 THEN 'Cancelled'</Line><Line>ELSE '** Invalid **'</Line><Line>END;</Line><Line></Line><Line>RETURN @ret</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnGetStock" file="AdventureWorks_201011112048_dbo.ufnGetStock.html" outputType="int"><Parameters><Parameter name="@ProductID" type="int"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnGetStock](@ProductID [int])</Line><Line>RETURNS [int] </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @ret int;</Line><Line></Line><Line>SELECT @ret = SUM(p.[Quantity]) </Line><Line>FROM [Production].[ProductInventory] p </Line><Line>WHERE p.[ProductID] = @ProductID </Line><Line>AND p.[LocationID] = '6'; -- Only look at inventory in the misc storage</Line><Line></Line><Line>IF (@ret IS NULL) </Line><Line>SET @ret = 0</Line><Line></Line><Line>RETURN @ret</Line><Line>END;</Line></Text></Function><Function name="dbo.ufnLeadingZeros" file="AdventureWorks_201011112048_dbo.ufnLeadingZeros.html" outputType="varchar (8)"><Parameters><Parameter name="@Value" type="int"/></Parameters><Text><Line>CREATE FUNCTION [dbo].[ufnLeadingZeros](</Line><Line>@Value int</Line><Line>) </Line><Line>RETURNS varchar(8) </Line><Line>WITH SCHEMABINDING </Line><Line>AS </Line><Line>BEGIN</Line><Line>DECLARE @ReturnValue varchar(8);</Line><Line>SET @ReturnValue = CONVERT(varchar(8), @Value);</Line><Line>SET @ReturnValue = REPLICATE('0', 8 - DATALENGTH(@ReturnValue)) + @ReturnValue;</Line><Line>RETURN (@ReturnValue);</Line><Line>END;</Line></Text></Function></Functions></Group></Groups></Database></STDDatabaseSchema>

