SQL 2005 Adventure Works OLTP

SQL Server 2005 sees a number of changes in SQL Server, not the least of which is a new sample database, Adventure Works Cycles. If you've been wishing for a sample database with more real world scenarios than Northwind provided, Adventure Works is a definite improvement. The documentation for this sample was produced from the Adventure Works database which ships with SQL Server 2005.

Generating this sample was as simple as locating the source SQL, opening DBDocumentor, and defining a simple project. Other than providing the textual description of this page, the project used the DBDocumentor installation defaults. All of the descriptions you see for the various SQL object attributes were present in the original source SQL. This means that if you've been providing descriptions for your SQL in either of Enterprise Manager, Query Analyzer, or the new SQL Management Studio, then DBDocumentor will automatically process and include them, assuming they're in the SQL files you supply to DBDocumentor. Of course if you prefer to not use the extended property based description of SQL Server 7.0 and higher, DBDocumentor has a rich set of annotation tags, which you can learn about in the DBDocumentor manual.

Version 4.20 of DBDocumentor extends support for SQL Server 2000 and 2005 by including SQL Server Reporting Services (SSRS) RDL support. By simply selecting to process RDL reports, and supplying the RDL files to DBDocumentor, you can obtain documentation of the queries in the report, and have them hyperlinked to all the other SQL objects you've included in the project.

The AdventureWorks database sample was developed by Microsoft Corporation, copyright 2005. SQL Server is a trademark of Microsoft Corporation

Document was prepared on: Tuesday, October 17, 2006
Help compiled by DBDocumentor, a Pikauba Software product. All rights reserved.


SQL 2005 Adventure Works OLTP - Stored procedures

Stored procedures SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following stored procedures are defined for this database.

dbo.uspGetBillOfMaterials
dbo.uspGetEmployeeManagers
dbo.uspGetManagerEmployees
dbo.uspGetWhereUsedProductID
HumanResources.uspUpdateEmployeeHireInfo
HumanResources.uspUpdateEmployeeLogin
HumanResources.uspUpdateEmployeePersonalInfo


SQL 2005 Adventure Works OLTP - Executes procedures

Executes procedures SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The procedures listed all execute one or more other procedures.

HumanResources.uspUpdateEmployeeHireInfo
HumanResources.uspUpdateEmployeeLogin
HumanResources.uspUpdateEmployeePersonalInfo


HumanResources.uspUpdateEmployeeHireInfo

Source code
Object type: Stored procedure

Updates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.

Syntax

HumanResources.uspUpdateEmployeeHireInfo ( EmployeeID, Title, HireDate, RateChangeDate, Rate, PayFrequency, CurrentFlag )

Parameters

Variable | Data Type | Required | Output | Description
EmployeeID | int | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid EmployeeID from the Employee table.
Title | nvarchar(50) | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a title for the employee.
HireDate | datetime | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a hire date for the employee.
RateChangeDate | datetime | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the date the rate changed for the employee.
Rate | money | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the new rate for the employee.
PayFrequency | tinyint | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the pay frequency for the employee.
CurrentFlag | Flag | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the current flag for the employee.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | Yes | No | No

Data Source Activity

Modifications | Description
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeePayHistory | Employee pay history.

Applies to

Stored procedures | Modifies data | Transactional | Executes procedures


HumanResources.uspUpdateEmployeeLogin

Source code
Object type: Stored procedure

Updates the Employee table with the values specified in the input parameters for the given EmployeeID.

Syntax

HumanResources.uspUpdateEmployeeLogin ( EmployeeID, ManagerID, LoginID, Title, HireDate, CurrentFlag )

Parameters

Variable | Data Type | Required | Output | Description
EmployeeID | int | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeLogin. Enter a valid EmployeeID from the Employee table.
ManagerID | int | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid ManagerID for the employee.
LoginID | nvarchar(256) | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid login for the employee.
Title | nvarchar(50) | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a title for the employee.
HireDate | datetime | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a hire date for the employee.
CurrentFlag | Flag | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the current flag for the employee.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | Yes | No | No

Data Source Activity

Modifications | Description
HumanResources.Employee | Employee information such as salary, department, and title.

Applies to

Stored procedures | Modifies data | Transactional | Executes procedures


HumanResources.uspUpdateEmployeePersonalInfo

Source code
Object type: Stored procedure

Updates the Employee table with the values specified in the input parameters for the given EmployeeID.

Syntax

HumanResources.uspUpdateEmployeePersonalInfo ( EmployeeID, NationalIDNumber, BirthDate, MaritalStatus, Gender )

Parameters

Variable | Data Type | Required | Output | Description
EmployeeID | int | Yes | No | Input parameter for the stored procedure uspUpdateEmployeePersonalInfo. Enter a valid EmployeeID from the HumanResources.Employee table.
NationalIDNumber | nvarchar(15) | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a national ID for the employee.
BirthDate | datetime | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a birth date for the employee.
MaritalStatus | nchar(1) | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a marital status for the employee.
Gender | nchar(1) | Yes | No | Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a gender for the employee.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | Yes | No | No

Data Source Activity

Modifications | Description
HumanResources.Employee | Employee information such as salary, department, and title.

Applies to

Stored procedures | Modifies data | Transactional | Executes procedures


SQL 2005 Adventure Works OLTP - Modifies data

Modifies data SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The procedures listed all modify at least one row in at least one table.

HumanResources.uspUpdateEmployeeHireInfo
HumanResources.uspUpdateEmployeeLogin
HumanResources.uspUpdateEmployeePersonalInfo


SQL 2005 Adventure Works OLTP - Returns data

Returns data SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The procedures listed all return data by way of a result set or output parameters. If the return method includes result sets, at least one result set is listed.

dbo.uspGetBillOfMaterials
dbo.uspGetEmployeeManagers
dbo.uspGetManagerEmployees
dbo.uspGetWhereUsedProductID


dbo.uspGetBillOfMaterials

Source code
Object type: Stored procedure

Stored procedure using a recursive query to return a multi-level bill of material for the specified ProductID.

Syntax

dbo.uspGetBillOfMaterials ( StartProductID, CheckDate )

Parameters

Variable | Data Type | Required | Output | Description
StartProductID | int | Yes | No | Input parameter for the stored procedure uspGetBillOfMaterials. Enter a valid ProductID from the Production.Product table.
CheckDate | datetime | Yes | No | Input parameter for the stored procedure uspGetBillOfMaterials used to eliminate components not used after that date. Enter a valid date.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No | No

Data Source Activity

Accesses | Description
BOM_cte
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.

Output Recordset

Column Description
ProductAssemblyID
ComponentID
ComponentDesc
TotalQuantity
StandardCost
ListPrice
BOMLevel
RecursionLevel

Data source Description
BOM_cte

Applies to

Stored procedures | Returns data


dbo.uspGetEmployeeManagers

Source code
Object type: Stored procedure

Stored procedure using a recursive query to return the direct and indirect managers of the specified employee.

Syntax

dbo.uspGetEmployeeManagers ( EmployeeID )

Parameters

Variable | Data Type | Required | Output | Description
EmployeeID | int | Yes | No | Input parameter for the stored procedure uspGetEmployeeManagers. Enter a valid EmployeeID from the HumanResources.Employee table.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No | No

Data Source Activity

Accesses | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
RecursionLevel
EmployeeID
FirstName
LastName
ManagerID
ManagerFirstName
ManagerLastName

Data source | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

Stored procedures | Returns data


dbo.uspGetManagerEmployees

Source code
Object type: Stored procedure

Stored procedure using a recursive query to return the direct and indirect employees of the specified manager.

Syntax

dbo.uspGetManagerEmployees ( ManagerID )

Parameters

Variable | Data Type | Required | Output | Description
ManagerID | int | Yes | No | Input parameter for the stored procedure uspGetManagerEmployees. Enter a valid ManagerID from the HumanResources.Employee table.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No | No

Data Source Activity

Accesses | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
RecursionLevel
ManagerID
ManagerFirstName
ManagerLastName
EmployeeID
FirstName
LastName

Data source | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

Stored procedures | Returns data


dbo.uspGetWhereUsedProductID

Source code
Object type: Stored procedure

Stored procedure using a recursive query to return all components or assemblies that directly or indirectly use the specified ProductID.

Syntax

dbo.uspGetWhereUsedProductID ( StartProductID, CheckDate )

Parameters

Variable | Data Type | Required | Output | Description
StartProductID | int | Yes | No | Input parameter for the stored procedure uspGetWhereUsedProductID. Enter a valid ProductID from the Production.Product table.
CheckDate | datetime | Yes | No | Input parameter for the stored procedure uspGetWhereUsedProductID used to eliminate components not used after that date. Enter a valid date.

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No | No

Data Source Activity

Accesses | Description
BOM_cte
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.

Output Recordset

Column Description
ProductAssemblyID
ComponentID
ComponentDesc
TotalQuantity
StandardCost
ListPrice
BOMLevel
RecursionLevel

Data source Description
BOM_cte

Applies to

Stored procedures | Returns data


SQL 2005 Adventure Works OLTP - Transactional

Transactional SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The procedures listed all perform at least part of their operations within a BEGIN TRANSACTION - COMMIT TRANSACTION block.

HumanResources.uspUpdateEmployeeHireInfo
HumanResources.uspUpdateEmployeeLogin
HumanResources.uspUpdateEmployeePersonalInfo


SQL 2005 Adventure Works OLTP - Triggers

Triggers SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following triggers are defined for this database.

dbo.uAWBuildVersion
ddlDatabaseTriggerLog
HumanResources.dEmployee
HumanResources.uDepartment
HumanResources.uEmployee
HumanResources.uEmployeeAddress
HumanResources.uEmployeeDepartmentHistory
HumanResources.uEmployeePayHistory
HumanResources.uJobCandidate
HumanResources.uShift
Person.uAddress
Person.uAddressType
Person.uContact
Person.uContactType
Person.uCountryRegion
Person.uStateProvince
Production.iWorkOrder
Production.uBillOfMaterials
Production.uCulture
Production.uDocument
Production.uIllustration
Production.uLocation
Production.uProduct
Production.uProductCategory
Production.uProductCostHistory
Production.uProductDescription
Production.uProductDocument
Production.uProductInventory
Production.uProductListPriceHistory
Production.uProductModel
Production.uProductModelIllustration
Production.uProductModelProductDescriptionCulture
Production.uProductPhoto
Production.uProductProductPhoto
Production.uProductReview
Production.uProductSubcategory
Production.uScrapReason
Production.uTransactionHistory
Production.uTransactionHistoryArchive
Production.uUnitMeasure
Production.uWorkOrder
Production.uWorkOrderRouting
Purchasing.dVendor
Purchasing.iPurchaseOrderDetail
Purchasing.uProductVendor
Purchasing.uPurchaseOrderDetail
Purchasing.uPurchaseOrderHeader
Purchasing.uShipMethod
Purchasing.uVendor
Purchasing.uVendorAddress
Purchasing.uVendorContact
Sales.iduSalesOrderDetail
Sales.iStore
Sales.iuIndividual
Sales.uContactCreditCard
Sales.uCountryRegionCurrency
Sales.uCreditCard
Sales.uCurrency
Sales.uCurrencyRate
Sales.uCustomer
Sales.uCustomerAddress
Sales.uSalesOrderHeader
Sales.uSalesOrderHeaderSalesReason
Sales.uSalesPerson
Sales.uSalesPersonQuotaHistory
Sales.uSalesReason
Sales.uSalesTaxRate
Sales.uSalesTerritory
Sales.uSalesTerritoryHistory
Sales.uShoppingCartItem
Sales.uSpecialOffer
Sales.uSpecialOfferProduct
Sales.uStore
Sales.uStoreContact


SQL 2005 Adventure Works OLTP - After table changes

After table changes SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all fire if the SQL modifcations were not successful.

dbo.uAWBuildVersion
ddlDatabaseTriggerLog
HumanResources.uDepartment
HumanResources.uEmployee
HumanResources.uEmployeeAddress
HumanResources.uEmployeeDepartmentHistory
HumanResources.uEmployeePayHistory
HumanResources.uJobCandidate
HumanResources.uShift
Person.uAddress
Person.uAddressType
Person.uContact
Person.uContactType
Person.uCountryRegion
Person.uStateProvince
Production.iWorkOrder
Production.uBillOfMaterials
Production.uCulture
Production.uDocument
Production.uIllustration
Production.uLocation
Production.uProduct
Production.uProductCategory
Production.uProductCostHistory
Production.uProductDescription
Production.uProductDocument
Production.uProductInventory
Production.uProductListPriceHistory
Production.uProductModel
Production.uProductModelIllustration
Production.uProductModelProductDescriptionCulture
Production.uProductPhoto
Production.uProductProductPhoto
Production.uProductReview
Production.uProductSubcategory
Production.uScrapReason
Production.uTransactionHistory
Production.uTransactionHistoryArchive
Production.uUnitMeasure
Production.uWorkOrder
Production.uWorkOrderRouting
Purchasing.iPurchaseOrderDetail
Purchasing.uProductVendor
Purchasing.uPurchaseOrderDetail
Purchasing.uPurchaseOrderHeader
Purchasing.uShipMethod
Purchasing.uVendor
Purchasing.uVendorAddress
Purchasing.uVendorContact
Sales.iduSalesOrderDetail
Sales.iStore
Sales.iuIndividual
Sales.uContactCreditCard
Sales.uCountryRegionCurrency
Sales.uCreditCard
Sales.uCurrency
Sales.uCurrencyRate
Sales.uCustomer
Sales.uCustomerAddress
Sales.uSalesOrderHeader
Sales.uSalesOrderHeaderSalesReason
Sales.uSalesPerson
Sales.uSalesPersonQuotaHistory
Sales.uSalesReason
Sales.uSalesTaxRate
Sales.uSalesTerritory
Sales.uSalesTerritoryHistory
Sales.uShoppingCartItem
Sales.uSpecialOffer
Sales.uSpecialOfferProduct
Sales.uStore
Sales.uStoreContact


dbo.uAWBuildVersion

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.

Summary

On table: Delete Update Insert Type
dbo.AWBuildVersion No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
dbo.AWBuildVersion | Current version number of the AdventureWorks sample database.

Applies to

Triggers | Modifies data | On update | After table changes


ddlDatabaseTriggerLog

Source code
Object type: Trigger

Summary

On object: Delete Update Insert Type
DATABASE No No Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
dbo.DatabaseLog | Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog.

Applies to

Triggers | Modifies data | After table changes


HumanResources.uDepartment

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.Department No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.Department | Lookup table containing the departments within the Adventure Works Cycles company.

Applies to

Triggers | Modifies data | On update | After table changes


HumanResources.uEmployee

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.Employee No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.Employee | Employee information such as salary, department, and title.

Applies to

Triggers | Modifies data | On update | After table changes


HumanResources.uEmployeeAddress

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.EmployeeAddress No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).

Applies to

Triggers | Modifies data | On update | After table changes


HumanResources.uEmployeeDepartmentHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.EmployeeDepartmentHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.EmployeeDepartmentHistory | Employee department transfers.

Applies to

Triggers | Modifies data | On update | After table changes


HumanResources.uEmployeePayHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.EmployeePayHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.EmployeePayHistory | Employee pay history.

Applies to

Triggers | Modifies data | On update | After table changes


HumanResources.uJobCandidate

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.JobCandidate No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Applies to

Triggers | Modifies data | On update | After table changes


HumanResources.uShift

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.

Summary

On table: Delete Update Insert Type
HumanResources.Shift No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
HumanResources.Shift | Work shift lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Person.uAddress

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.

Summary

On table: Delete Update Insert Type
Person.Address No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Person.Address | Street address information for customers, employees, and vendors.

Applies to

Triggers | Modifies data | On update | After table changes


Person.uAddressType

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.

Summary

On table: Delete Update Insert Type
Person.AddressType No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Person.AddressType | Types of addresses stored in the Address table.

Applies to

Triggers | Modifies data | On update | After table changes


Person.uContact

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.

Summary

On table: Delete Update Insert Type
Person.Contact No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

Triggers | Modifies data | On update | After table changes


Person.uContactType

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.

Summary

On table: Delete Update Insert Type
Person.ContactType No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Person.ContactType | Lookup table containing the types of contacts stored in Contact.

Applies to

Triggers | Modifies data | On update | After table changes


Person.uCountryRegion

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.

Summary

On table: Delete Update Insert Type
Person.CountryRegion No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.

Applies to

Triggers | Modifies data | On update | After table changes


Person.uStateProvince

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.

Summary

On table: Delete Update Insert Type
Person.StateProvince No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Person.StateProvince | State and province lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Production.iWorkOrder

Source code
Object type: Trigger

AFTER INSERT trigger that inserts a row in the TransactionHistory table.

Summary

On table: Delete Update Insert Type
Production.WorkOrder No No Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.

Applies to

Triggers | Modifies data | Transactional | On insert | After table changes


Production.uBillOfMaterials

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.

Summary

On table: Delete Update Insert Type
Production.BillOfMaterials No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uCulture

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.

Summary

On table: Delete Update Insert Type
Production.Culture No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.Culture | Lookup table containing the languages in which some AdventureWorks data is stored.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uDocument

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.

Summary

On table: Delete Update Insert Type
Production.Document No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.Document | Product maintenance documents.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uIllustration

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.

Summary

On table: Delete Update Insert Type
Production.Illustration No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.Illustration | Bicycle assembly diagrams.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uLocation

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.

Summary

On table: Delete Update Insert Type
Production.Location No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.Location | Product inventory and manufacturing locations.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProduct

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.

Summary

On table: Delete Update Insert Type
Production.Product No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.Product | Products sold or used in the manfacturing of sold products.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductCategory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductCategory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductCategory | High-level product categorization.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductCostHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductCostHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductCostHistory | Changes in the cost of a product over time.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductDescription

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductDescription No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductDescription | Product descriptions in several languages.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductDocument

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductDocument No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductDocument | Cross-reference table mapping products to related product documents.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductInventory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductInventory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductInventory | Product inventory information.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductListPriceHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductListPriceHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductListPriceHistory | Changes in the list price of a product over time.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductModel

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductModel No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductModel | Product model classification.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductModelIllustration

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductModelIllustration No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductModelIllustration | Cross-reference table mapping product models and illustrations.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductModelProductDescriptionCulture

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductModelProductDescriptionCulture No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductPhoto

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductPhoto No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductPhoto | Product images.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductProductPhoto

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductProductPhoto No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductProductPhoto | Cross-reference table mapping products and product photos.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductReview

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductReview No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductReview | Customer reviews of products they have purchased.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uProductSubcategory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.

Summary

On table: Delete Update Insert Type
Production.ProductSubcategory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ProductSubcategory | Product subcategories. See ProductCategory table.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uScrapReason

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.

Summary

On table: Delete Update Insert Type
Production.ScrapReason No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.ScrapReason | Manufacturing failure reasons lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uTransactionHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.

Summary

On table: Delete Update Insert Type
Production.TransactionHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uTransactionHistoryArchive

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.

Summary

On table: Delete Update Insert Type
Production.TransactionHistoryArchive No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistoryArchive | Transactions for previous years.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uUnitMeasure

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.

Summary

On table: Delete Update Insert Type
Production.UnitMeasure No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.UnitMeasure | Unit of measure lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Production.uWorkOrder

Source code
Object type: Trigger

AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.

Summary

On table: Delete Update Insert Type
Production.WorkOrder No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.
Production.WorkOrder | Manufacturing work orders.

Applies to

Triggers | Modifies data | Transactional | On update | After table changes


Production.uWorkOrderRouting

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.

Summary

On table: Delete Update Insert Type
Production.WorkOrderRouting No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Production.WorkOrderRouting | Work order details.

Applies to

Triggers | Modifies data | On update | After table changes


Purchasing.iPurchaseOrderDetail

Source code
Object type: Trigger

AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.

Summary

On table: Delete Update Insert Type
Purchasing.PurchaseOrderDetail No No Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.

Accesses | Description
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.

Applies to

Triggers | Modifies data | Transactional | On insert | After table changes


Purchasing.uProductVendor

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.

Summary

On table: Delete Update Insert Type
Purchasing.ProductVendor No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Purchasing.ProductVendor | Cross-reference table mapping vendors with the products they supply.

Applies to

Triggers | Modifies data | On update | After table changes


Purchasing.uPurchaseOrderDetail

Source code
Object type: Trigger

AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.

Summary

On table: Delete Update Insert Type
Purchasing.PurchaseOrderDetail No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.
Purchasing.PurchaseOrderDetail | Individual products associated with a specific purchase order. See PurchaseOrderHeader.
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.

Accesses | Description
Purchasing.PurchaseOrderDetail | Individual products associated with a specific purchase order. See PurchaseOrderHeader.

Applies to

Triggers | Modifies data | Transactional | On update | After table changes


Purchasing.uPurchaseOrderHeader

Source code
Object type: Trigger

AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.

Summary

On table: Delete Update Insert Type
Purchasing.PurchaseOrderHeader No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.

Applies to

Triggers | Modifies data | Transactional | On update | After table changes


Purchasing.uShipMethod

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.

Summary

On table: Delete Update Insert Type
Purchasing.ShipMethod No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Purchasing.ShipMethod | Shipping company lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Purchasing.uVendor

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.

Summary

On table: Delete Update Insert Type
Purchasing.Vendor No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Purchasing.Vendor | Companies from whom Adventure Works Cycles purchases parts or other goods.

Applies to

Triggers | Modifies data | On update | After table changes


Purchasing.uVendorAddress

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.

Summary

On table: Delete Update Insert Type
Purchasing.VendorAddress No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Purchasing.VendorAddress | Cross-reference mapping vendors and addresses.

Applies to

Triggers | Modifies data | On update | After table changes


Purchasing.uVendorContact

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.

Summary

On table: Delete Update Insert Type
Purchasing.VendorContact No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.iduSalesOrderDetail

Source code
Object type: Trigger

AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.

Summary

On table: Delete Update Insert Type
Sales.SalesOrderDetail Yes Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.

Accesses | Description
Sales.SalesOrderHeader | General sales order information.

Applies to

Triggers | Modifies data | Transactional | On delete | On update | On insert | After table changes


Sales.iStore

Source code
Object type: Trigger

AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.

Summary

On table: Delete Update Insert Type
Sales.Store No No Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | Yes | No | No | No | No

Applies to

Triggers | Transactional | On insert | After table changes


Sales.iuIndividual

Source code
Object type: Trigger

AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.

Summary

On table: Delete Update Insert Type
Sales.Individual No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.

Applies to

Triggers | Modifies data | Transactional | On update | On insert | After table changes


Sales.uContactCreditCard

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.

Summary

On table: Delete Update Insert Type
Sales.ContactCreditCard No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.ContactCreditCard | Cross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uCountryRegionCurrency

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.

Summary

On table: Delete Update Insert Type
Sales.CountryRegionCurrency No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.CountryRegionCurrency | Cross-reference table mapping ISO currency codes to a country or region.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uCreditCard

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.

Summary

On table: Delete Update Insert Type
Sales.CreditCard No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.CreditCard | Customer credit card information.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uCurrency

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.

Summary

On table: Delete Update Insert Type
Sales.Currency No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.Currency | Lookup table containing standard ISO currencies.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uCurrencyRate

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.

Summary

On table: Delete Update Insert Type
Sales.CurrencyRate No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.CurrencyRate | Currency exchange rates.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uCustomer

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.

Summary

On table: Delete Update Insert Type
Sales.Customer No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.Customer | Current customer information. Also see the Individual and Store tables.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uCustomerAddress

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.

Summary

On table: Delete Update Insert Type
Sales.CustomerAddress No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesOrderHeader

Source code
Object type: Trigger

AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.

Summary

On table: Delete Update Insert Type
Sales.SalesOrderHeader No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | Yes | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Called functions

Name | Description
dbo.ufnGetAccountingEndDate | Scalar function used in the uSalesOrderHeader trigger to set the starting account date.
dbo.ufnGetAccountingStartDate | Scalar function used in the uSalesOrderHeader trigger to set the ending account date.

Applies to

Triggers | Modifies data | Transactional | On update | After table changes


Sales.uSalesOrderHeaderSalesReason

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesOrderHeaderSalesReason No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesOrderHeaderSalesReason | Cross-reference table mapping sales orders to sales reason codes.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesPerson

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesPerson No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesPerson | Sales representative current information.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesPersonQuotaHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesPersonQuotaHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesPersonQuotaHistory | Sales performance tracking.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesReason

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesReason No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesReason | Lookup table of customer purchase reasons.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesTaxRate

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesTaxRate No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesTaxRate | Tax rate lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesTerritory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesTerritory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesTerritory | Sales territory lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSalesTerritoryHistory

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SalesTerritoryHistory No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SalesTerritoryHistory | Sales representative transfers to other sales territories.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uShoppingCartItem

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.

Summary

On table: Delete Update Insert Type
Sales.ShoppingCartItem No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.ShoppingCartItem | Contains online customer orders until the order is submitted or cancelled.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSpecialOffer

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SpecialOffer No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SpecialOffer | Sale discounts lookup table.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uSpecialOfferProduct

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.

Summary

On table: Delete Update Insert Type
Sales.SpecialOfferProduct No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.SpecialOfferProduct | Cross-reference table mapping products to special offer discounts.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uStore

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.

Summary

On table: Delete Update Insert Type
Sales.Store No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.Store | Customers (resellers) of Adventure Works products.

Applies to

Triggers | Modifies data | On update | After table changes


Sales.uStoreContact

Source code
Object type: Trigger

AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.

Summary

On table: Delete Update Insert Type
Sales.StoreContact No Yes Yes After

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
Yes | No | No | No | No | No

Data Source Activity

Modifications | Description
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Applies to

Triggers | Modifies data | On update | After table changes


SQL 2005 Adventure Works OLTP - Instead of table changes

Instead of table changes SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all fire if the SQL modifcations were successful.

HumanResources.dEmployee
Purchasing.dVendor


HumanResources.dEmployee

Source code
Object type: Trigger

INSTEAD OF DELETE trigger which keeps Employees from being deleted.

Summary

On table: Delete Update Insert Type
HumanResources.Employee Yes No Yes Instead of

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | Yes | No | No | No | No

Errors raised

Message | ID | Severity | State
Employees cannot be deleted. They can only be marked as not current. | 50000 | 10 | 1

Applies to

Triggers | Transactional | On delete | Instead of table changes


Purchasing.dVendor

Source code
Object type: Trigger

INSTEAD OF DELETE trigger which keeps Vendors from being deleted.

Summary

On table: Delete Update Insert Type
Purchasing.Vendor Yes No Yes Instead of

Properties

Modifies data | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | Yes | No | No | No | No

Errors raised

Message | ID | Severity | State
Vendors cannot be deleted. They can only be marked as not active. | 50000 | 10 | 1

Applies to

Triggers | Transactional | On delete | Instead of table changes


SQL 2005 Adventure Works OLTP - Modifies data

Modifies data SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all modify at least one row in at least one table.

dbo.uAWBuildVersion
ddlDatabaseTriggerLog
HumanResources.uDepartment
HumanResources.uEmployee
HumanResources.uEmployeeAddress
HumanResources.uEmployeeDepartmentHistory
HumanResources.uEmployeePayHistory
HumanResources.uJobCandidate
HumanResources.uShift
Person.uAddress
Person.uAddressType
Person.uContact
Person.uContactType
Person.uCountryRegion
Person.uStateProvince
Production.iWorkOrder
Production.uBillOfMaterials
Production.uCulture
Production.uDocument
Production.uIllustration
Production.uLocation
Production.uProduct
Production.uProductCategory
Production.uProductCostHistory
Production.uProductDescription
Production.uProductDocument
Production.uProductInventory
Production.uProductListPriceHistory
Production.uProductModel
Production.uProductModelIllustration
Production.uProductModelProductDescriptionCulture
Production.uProductPhoto
Production.uProductProductPhoto
Production.uProductReview
Production.uProductSubcategory
Production.uScrapReason
Production.uTransactionHistory
Production.uTransactionHistoryArchive
Production.uUnitMeasure
Production.uWorkOrder
Production.uWorkOrderRouting
Purchasing.iPurchaseOrderDetail
Purchasing.uProductVendor
Purchasing.uPurchaseOrderDetail
Purchasing.uPurchaseOrderHeader
Purchasing.uShipMethod
Purchasing.uVendor
Purchasing.uVendorAddress
Purchasing.uVendorContact
Sales.iduSalesOrderDetail
Sales.iuIndividual
Sales.uContactCreditCard
Sales.uCountryRegionCurrency
Sales.uCreditCard
Sales.uCurrency
Sales.uCurrencyRate
Sales.uCustomer
Sales.uCustomerAddress
Sales.uSalesOrderHeader
Sales.uSalesOrderHeaderSalesReason
Sales.uSalesPerson
Sales.uSalesPersonQuotaHistory
Sales.uSalesReason
Sales.uSalesTaxRate
Sales.uSalesTerritory
Sales.uSalesTerritoryHistory
Sales.uShoppingCartItem
Sales.uSpecialOffer
Sales.uSpecialOfferProduct
Sales.uStore
Sales.uStoreContact


SQL 2005 Adventure Works OLTP - On delete

On delete SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all fire when their data in their associated table is deleted.

HumanResources.dEmployee
Purchasing.dVendor
Sales.iduSalesOrderDetail


SQL 2005 Adventure Works OLTP - On insert

On insert SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all fire when data is inserted into their associated table.

Production.iWorkOrder
Purchasing.iPurchaseOrderDetail
Sales.iduSalesOrderDetail
Sales.iStore
Sales.iuIndividual


SQL 2005 Adventure Works OLTP - On update

On update SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all fire when the data in their associated table is updated.

dbo.uAWBuildVersion
HumanResources.uDepartment
HumanResources.uEmployee
HumanResources.uEmployeeAddress
HumanResources.uEmployeeDepartmentHistory
HumanResources.uEmployeePayHistory
HumanResources.uJobCandidate
HumanResources.uShift
Person.uAddress
Person.uAddressType
Person.uContact
Person.uContactType
Person.uCountryRegion
Person.uStateProvince
Production.uBillOfMaterials
Production.uCulture
Production.uDocument
Production.uIllustration
Production.uLocation
Production.uProduct
Production.uProductCategory
Production.uProductCostHistory
Production.uProductDescription
Production.uProductDocument
Production.uProductInventory
Production.uProductListPriceHistory
Production.uProductModel
Production.uProductModelIllustration
Production.uProductModelProductDescriptionCulture
Production.uProductPhoto
Production.uProductProductPhoto
Production.uProductReview
Production.uProductSubcategory
Production.uScrapReason
Production.uTransactionHistory
Production.uTransactionHistoryArchive
Production.uUnitMeasure
Production.uWorkOrder
Production.uWorkOrderRouting
Purchasing.uProductVendor
Purchasing.uPurchaseOrderDetail
Purchasing.uPurchaseOrderHeader
Purchasing.uShipMethod
Purchasing.uVendor
Purchasing.uVendorAddress
Purchasing.uVendorContact
Sales.iduSalesOrderDetail
Sales.iuIndividual
Sales.uContactCreditCard
Sales.uCountryRegionCurrency
Sales.uCreditCard
Sales.uCurrency
Sales.uCurrencyRate
Sales.uCustomer
Sales.uCustomerAddress
Sales.uSalesOrderHeader
Sales.uSalesOrderHeaderSalesReason
Sales.uSalesPerson
Sales.uSalesPersonQuotaHistory
Sales.uSalesReason
Sales.uSalesTaxRate
Sales.uSalesTerritory
Sales.uSalesTerritoryHistory
Sales.uShoppingCartItem
Sales.uSpecialOffer
Sales.uSpecialOfferProduct
Sales.uStore
Sales.uStoreContact


SQL 2005 Adventure Works OLTP - Transactional

Transactional SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The triggers listed all perform at least part of their operations within a BEGIN TRANSACTION - COMMIT TRANSACTION block.

HumanResources.dEmployee
Production.iWorkOrder
Production.uWorkOrder
Purchasing.dVendor
Purchasing.iPurchaseOrderDetail
Purchasing.uPurchaseOrderDetail
Purchasing.uPurchaseOrderHeader
Sales.iduSalesOrderDetail
Sales.iStore
Sales.iuIndividual
Sales.uSalesOrderHeader


SQL 2005 Adventure Works OLTP - Views

Views SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following data views are defined for this database.

BOM_cte used in procedure: dbo.uspGetBillOfMaterials
BOM_cte used in procedure: dbo.uspGetWhereUsedProductID
EMP_cte used in procedure: dbo.uspGetEmployeeManagers
EMP_cte used in procedure: dbo.uspGetManagerEmployees
HumanResources.vEmployee
HumanResources.vEmployeeDepartment
HumanResources.vEmployeeDepartmentHistory
HumanResources.vJobCandidate
HumanResources.vJobCandidateEducation
HumanResources.vJobCandidateEmployment
Person.vAdditionalContactInfo
Person.vStateProvinceCountryRegion
Production.vProductAndDescription
Production.vProductModelCatalogDescription
Production.vProductModelInstructions
Purchasing.vVendor
Sales.vIndividual
Sales.vIndividualDemographics
Sales.vSalesPerson
Sales.vSalesPersonSalesByFiscalYears
Sales.vStoreWithDemographics


SQL 2005 Adventure Works OLTP - Table expressions

Table expressions SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The views listed are dynamic views into joined data. They are commonly refered to as Common Table Expressions.

BOM_cte used in procedure: dbo.uspGetBillOfMaterials
BOM_cte used in procedure: dbo.uspGetWhereUsedProductID
EMP_cte used in procedure: dbo.uspGetEmployeeManagers
EMP_cte used in procedure: dbo.uspGetManagerEmployees


BOM_cte used in procedure: dbo.uspGetBillOfMaterials

Source code
Object type: Common table expression

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
BOM_cte
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.

Output Recordset

Column Description
ProductAssemblyID
ComponentID
ComponentDesc
PerAssemblyQty
StandardCost
ListPrice
BOMLevel
RecursionLevel

Data source | Description
BOM_cte
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.

Accessed by

Name | Description
dbo.uspGetBillOfMaterials | Stored procedure using a recursive query to return a multi-level bill of material for the specified ProductID.

Applies to

Views | Table expressions


BOM_cte used in procedure: dbo.uspGetWhereUsedProductID

Source code
Object type: Common table expression

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
BOM_cte
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.

Output Recordset

Column Description
ProductAssemblyID
ComponentID
ComponentDesc
PerAssemblyQty
StandardCost
ListPrice
BOMLevel
RecursionLevel

Data source | Description
BOM_cte
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.

Accessed by

Name | Description
dbo.uspGetWhereUsedProductID | Stored procedure using a recursive query to return all components or assemblies that directly or indirectly use the specified ProductID.

Applies to

Views | Table expressions


EMP_cte used in procedure: dbo.uspGetEmployeeManagers

Source code
Object type: Common table expression

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
EmployeeID
ManagerID
FirstName
LastName
Title
RecursionLevel

Data source | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Accessed by

Name | Description
dbo.uspGetEmployeeManagers | Stored procedure using a recursive query to return the direct and indirect managers of the specified employee.

Applies to

Views | Table expressions


EMP_cte used in procedure: dbo.uspGetManagerEmployees

Source code
Object type: Common table expression

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
EmployeeID
ManagerID
FirstName
LastName
RecursionLevel

Data source | Description
EMP_cte
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Accessed by

Name | Description
dbo.uspGetManagerEmployees | Stored procedure using a recursive query to return the direct and indirect employees of the specified manager.

Applies to

Views | Table expressions


HumanResources.vEmployee

Source code
Object type: Data view

Employee names and addresses.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.

Output Recordset

Column Description
EmployeeID
Title
FirstName
MiddleName
LastName
Suffix
JobTitle
Phone
EmailAddress
EmailPromotion
AddressLine1
AddressLine2
City
StateProvinceName
PostalCode
CountryRegionName
AdditionalContactInfo

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.

Applies to

Views


HumanResources.vEmployeeDepartment

Source code
Object type: Data view

Returns employee name, title, and current department.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Department | Lookup table containing the departments within the Adventure Works Cycles company.
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeDepartmentHistory | Employee department transfers.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
EmployeeID
Title
FirstName
MiddleName
LastName
Suffix
JobTitle
Department
GroupName
StartDate

Data source | Description
HumanResources.Department | Lookup table containing the departments within the Adventure Works Cycles company.
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeDepartmentHistory | Employee department transfers.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

Views


HumanResources.vEmployeeDepartmentHistory

Source code
Object type: Data view

Returns employee name and current and previous departments.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Department | Lookup table containing the departments within the Adventure Works Cycles company.
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeDepartmentHistory | Employee department transfers.
HumanResources.Shift | Work shift lookup table.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
EmployeeID
Title
FirstName
MiddleName
LastName
Suffix
Shift
Department
GroupName
StartDate
EndDate

Data source | Description
HumanResources.Department | Lookup table containing the departments within the Adventure Works Cycles company.
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeDepartmentHistory | Employee department transfers.
HumanResources.Shift | Work shift lookup table.
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

Views


HumanResources.vJobCandidate

Source code
Object type: Data view

Job candidate names and resumes.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Output Recordset

Column Description
JobCandidateID
EmployeeID
Name.Prefix
Name.First
Name.Middle
Name.Last
Name.Suffix
Skills
Addr.Type
Addr.Loc.CountryRegion
Addr.Loc.State
Addr.Loc.City
Addr.PostalCode
EMail
WebSite
ModifiedDate

Data source | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Applies to

Views


HumanResources.vJobCandidateEducation

Source code
Object type: Data view

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.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Output Recordset

Column Description
JobCandidateID
Edu.Level
Edu.StartDate
Edu.EndDate
Edu.Degree
Edu.Major
Edu.Minor
Edu.GPA
Edu.GPAScale
Edu.School
Edu.Loc.CountryRegion
Edu.Loc.State
Edu.Loc.City

Data source | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Applies to

Views


HumanResources.vJobCandidateEmployment

Source code
Object type: Data view

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.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Output Recordset

Column Description
JobCandidateID
Emp.StartDate
Emp.EndDate
Emp.OrgName
Emp.JobTitle
Emp.Responsibility
Emp.FunctionCategory
Emp.IndustryCategory
Emp.Loc.CountryRegion
Emp.Loc.State
Emp.Loc.City

Data source | Description
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.

Applies to

Views


Person.vAdditionalContactInfo

Source code
Object type: Data view

Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Person.Contact | Names of each employee, customer contact, and vendor contact.

Output Recordset

Column Description
ContactID
FirstName
MiddleName
LastName
TelephoneNumber
TelephoneSpecialInstructions
Street
City
StateProvince
PostalCode
CountryRegion
HomeAddressSpecialInstructions
EMailAddress
EMailSpecialInstructions
EMailTelephoneNumber
rowguid
ModifiedDate

Data source | Description
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

Views


Person.vStateProvinceCountryRegion

Source code
Object type: Data view

Joins StateProvince table with CountryRegion table.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.

Output Recordset

Column Description
StateProvinceID
StateProvinceCode
IsOnlyStateProvinceFlag
StateProvinceName
TerritoryID
CountryRegionCode
CountryRegionName

Data source | Description
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.

Indices

Name | Description
IX_vStateProvinceCountryRegion | Clustered index on the view vStateProvinceCountryRegion.

Applies to

Views


Production.vProductAndDescription

Source code
Object type: Data view

Product names and descriptions. Product descriptions are provided in multiple languages.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductDescription | Product descriptions in several languages.
Production.ProductModel | Product model classification.
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.

Output Recordset

Column Description
ProductID
Name
ProductModel
CultureID
Description

Data source | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductDescription | Product descriptions in several languages.
Production.ProductModel | Product model classification.
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.

Indices

Name | Description
IX_vProductAndDescription | Clustered index on the view vProductAndDescription.

Applies to

Views


Production.vProductModelCatalogDescription

Source code
Object type: Data view

Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Production.ProductModel | Product model classification.

Output Recordset

Column Description
ProductModelID
Name
Summary
Manufacturer
Copyright
ProductURL
WarrantyPeriod
WarrantyDescription
NoOfYears
MaintenanceDescription
Wheel
Saddle
Pedal
BikeFrame
Crankset
PictureAngle
PictureSize
ProductPhotoID
Material
Color
ProductLine
Style
RiderExperience
rowguid
ModifiedDate

Data source | Description
Production.ProductModel | Product model classification.

Applies to

Views


Production.vProductModelInstructions

Source code
Object type: Data view

Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Production.ProductModel | Product model classification.

Output Recordset

Column Description
ProductModelID
Name
Instructions
LocationID
SetupHours
MachineHours
LaborHours
LotSize
Step
rowguid
ModifiedDate

Data source | Description
Production.ProductModel | Product model classification.

Applies to

Views


Purchasing.vVendor

Source code
Object type: Data view

Vendor (company) names and addresses and the names of vendor employees to contact.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.ContactType | Lookup table containing the types of contacts stored in Contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Purchasing.Vendor | Companies from whom Adventure Works Cycles purchases parts or other goods.
Purchasing.VendorAddress | Cross-reference mapping vendors and addresses.
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.

Output Recordset

Column Description
VendorID
Name
ContactType
Title
FirstName
MiddleName
LastName
Suffix
Phone
EmailAddress
EmailPromotion
AddressLine1
AddressLine2
City
StateProvinceName
PostalCode
CountryRegionName

Data source | Description
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.ContactType | Lookup table containing the types of contacts stored in Contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Purchasing.Vendor | Companies from whom Adventure Works Cycles purchases parts or other goods.
Purchasing.VendorAddress | Cross-reference mapping vendors and addresses.
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.

Applies to

Views


Sales.vIndividual

Source code
Object type: Data view

Individual customers (names and addresses) that purchase Adventure Works Cycles products online.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.

Output Recordset

Column Description
CustomerID
Title
FirstName
MiddleName
LastName
Suffix
Phone
EmailAddress
EmailPromotion
AddressLine1
AddressLine2
City
StateProvinceName
PostalCode
CountryRegionName
Demographics

Data source | Description
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.

Applies to

Views


Sales.vIndividualDemographics

Source code
Object type: Data view

Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.

Output Recordset

Column Description
CustomerID
TotalPurchaseYTD
DateFirstPurchase
BirthDate
MaritalStatus
YearlyIncome
Gender
TotalChildren
NumberChildrenAtHome
Education
Occupation
HomeOwnerFlag
NumberCarsOwned
Hobby

Data source | Description
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.

Called functions

Name Description
Demographics.value

Applies to

Views


Sales.vSalesPerson

Source code
Object type: Data view

Sales representiatives (names and addresses) and their sales-related information.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Output Recordset

Column Description
SalesPersonID
Title
FirstName
MiddleName
LastName
Suffix
JobTitle
Phone
EmailAddress
EmailPromotion
AddressLine1
AddressLine2
City
StateProvinceName
PostalCode
CountryRegionName
TerritoryName
TerritoryGroup
SalesQuota
SalesYTD
SalesLastYear

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Applies to

Views


Sales.vSalesPersonSalesByFiscalYears

Source code
Object type: Data view

Uses PIVOT to return aggregated sales information for each sales representative.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Output Recordset

Column Description
SalesPersonID
FullName
Title
SalesTerritory
2002
2003
2004

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Applies to

Views


Sales.vStoreWithDemographics

Source code
Object type: Data view

Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
No | No | No | No | No

Data Source Activity

Accesses | Description
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.ContactType | Lookup table containing the types of contacts stored in Contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).
Sales.Store | Customers (resellers) of Adventure Works products.
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Output Recordset

Column Description
CustomerID
Name
ContactType
Title
FirstName
MiddleName
LastName
Suffix
Phone
EmailAddress
EmailPromotion
AddressLine1
AddressLine2
City
StateProvinceName
PostalCode
CountryRegionName
AnnualSales
AnnualRevenue
BankName
BusinessType
YearOpened
Specialty
SquareFeet
Brands
Internet
NumberEmployees

Data source | Description
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.ContactType | Lookup table containing the types of contacts stored in Contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).
Sales.Store | Customers (resellers) of Adventure Works products.
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Applies to

Views


SQL 2005 Adventure Works OLTP - Indices

Indices SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following indicies are defined for this database.

AK_Address_rowguid on Person.Address
AK_AddressType_Name on Person.AddressType
AK_AddressType_rowguid on Person.AddressType
AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate on Production.BillOfMaterials
AK_Contact_rowguid on Person.Contact
AK_ContactType_Name on Person.ContactType
AK_CountryRegion_Name on Person.CountryRegion
AK_CreditCard_CardNumber on Sales.CreditCard
AK_Culture_Name on Production.Culture
AK_Currency_Name on Sales.Currency
AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode on Sales.CurrencyRate
AK_Customer_AccountNumber on Sales.Customer
AK_Customer_rowguid on Sales.Customer
AK_CustomerAddress_rowguid on Sales.CustomerAddress
AK_Department_Name on HumanResources.Department
AK_Document_FileName_Revision on Production.Document
AK_Employee_LoginID on HumanResources.Employee
AK_Employee_NationalIDNumber on HumanResources.Employee
AK_Employee_rowguid on HumanResources.Employee
AK_EmployeeAddress_rowguid on HumanResources.EmployeeAddress
AK_Location_Name on Production.Location
AK_Product_Name on Production.Product
AK_Product_ProductNumber on Production.Product
AK_Product_rowguid on Production.Product
AK_ProductCategory_Name on Production.ProductCategory
AK_ProductCategory_rowguid on Production.ProductCategory
AK_ProductDescription_rowguid on Production.ProductDescription
AK_ProductInventory_rowguid on Production.ProductInventory
AK_ProductModel_Name on Production.ProductModel
AK_ProductModel_rowguid on Production.ProductModel
AK_ProductProductPhoto_ProductID_ProductPhotoID on Production.ProductProductPhoto
AK_ProductSubcategory_Name on Production.ProductSubcategory
AK_ProductSubcategory_rowguid on Production.ProductSubcategory
AK_SalesOrderDetail_rowguid on Sales.SalesOrderDetail
AK_SalesOrderHeader_rowguid on Sales.SalesOrderHeader
AK_SalesOrderHeader_SalesOrderNumber on Sales.SalesOrderHeader
AK_SalesPerson_rowguid on Sales.SalesPerson
AK_SalesPersonQuotaHistory_rowguid on Sales.SalesPersonQuotaHistory
AK_SalesTaxRate_rowguid on Sales.SalesTaxRate
AK_SalesTaxRate_StateProvinceID_TaxType on Sales.SalesTaxRate
AK_SalesTerritory_Name on Sales.SalesTerritory
AK_SalesTerritory_rowguid on Sales.SalesTerritory
AK_SalesTerritoryHistory_rowguid on Sales.SalesTerritoryHistory
AK_ScrapReason_Name on Production.ScrapReason
AK_Shift_Name on HumanResources.Shift
AK_Shift_StartTime_EndTime on HumanResources.Shift
AK_ShipMethod_Name on Purchasing.ShipMethod
AK_ShipMethod_rowguid on Purchasing.ShipMethod
AK_SpecialOffer_rowguid on Sales.SpecialOffer
AK_SpecialOfferProduct_rowguid on Sales.SpecialOfferProduct
AK_StateProvince_Name on Person.StateProvince
AK_StateProvince_rowguid on Person.StateProvince
AK_StateProvince_StateProvinceCode_CountryRegionCode on Person.StateProvince
AK_Store_rowguid on Sales.Store
AK_StoreContact_rowguid on Sales.StoreContact
AK_UnitMeasure_Name on Production.UnitMeasure
AK_Vendor_AccountNumber on Purchasing.Vendor
IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode on Person.Address
IX_Address_StateProvinceID on Person.Address
IX_BillOfMaterials_UnitMeasureCode on Production.BillOfMaterials
IX_Contact_EmailAddress on Person.Contact
IX_CountryRegionCurrency_CurrencyCode on Sales.CountryRegionCurrency
IX_Customer_TerritoryID on Sales.Customer
IX_Employee_ManagerID on HumanResources.Employee
IX_EmployeeDepartmentHistory_DepartmentID on HumanResources.EmployeeDepartmentHistory
IX_EmployeeDepartmentHistory_ShiftID on HumanResources.EmployeeDepartmentHistory
IX_JobCandidate_EmployeeID on HumanResources.JobCandidate
IX_ProductInventory_ProductID on Production.ProductInventory
IX_ProductReview_ProductID_Name on Production.ProductReview
IX_ProductVendor_UnitMeasureCode on Purchasing.ProductVendor
IX_ProductVendor_VendorID on Purchasing.ProductVendor
IX_PurchaseOrderDetail_ProductID on Purchasing.PurchaseOrderDetail
IX_PurchaseOrderHeader_EmployeeID on Purchasing.PurchaseOrderHeader
IX_PurchaseOrderHeader_VendorID on Purchasing.PurchaseOrderHeader
IX_SalesOrderDetail_ProductID on Sales.SalesOrderDetail
IX_SalesOrderHeader_CustomerID on Sales.SalesOrderHeader
IX_SalesOrderHeader_SalesPersonID on Sales.SalesOrderHeader
IX_ShoppingCartItem_ShoppingCartID_ProductID on Sales.ShoppingCartItem
IX_SpecialOfferProduct_ProductID on Sales.SpecialOfferProduct
IX_Store_SalesPersonID on Sales.Store
IX_StoreContact_ContactID on Sales.StoreContact
IX_StoreContact_ContactTypeID on Sales.StoreContact
IX_TransactionHistory_ProductID on Production.TransactionHistory
IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID on Production.TransactionHistory
IX_TransactionHistoryArchive_ProductID on Production.TransactionHistoryArchive
IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID on Production.TransactionHistoryArchive
IX_VendorAddress_AddressID on Purchasing.VendorAddress
IX_VendorContact_ContactID on Purchasing.VendorContact
IX_VendorContact_ContactTypeID on Purchasing.VendorContact
IX_vProductAndDescription on Production.vProductAndDescription
IX_vStateProvinceCountryRegion on Person.vStateProvinceCountryRegion
IX_WorkOrder_ProductID on Production.WorkOrder
IX_WorkOrder_ScrapReasonID on Production.WorkOrder
IX_WorkOrderRouting_ProductID on Production.WorkOrderRouting
PXML_Contact_AddContact on Person.Contact
PXML_Individual_Demographics on Sales.Individual
PXML_ProductModel_CatalogDescription on Production.ProductModel
PXML_ProductModel_Instructions on Production.ProductModel
PXML_Store_Demographics on Sales.Store
XMLPATH_Individual_Demographics on Sales.Individual
XMLPROPERTY_Individual_Demographics on Sales.Individual
XMLVALUE_Individual_Demographics on Sales.Individual


SQL 2005 Adventure Works OLTP - Clustered

Clustered SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The indicies listed are clustered.

AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate on Production.BillOfMaterials
IX_vProductAndDescription on Production.vProductAndDescription
IX_vStateProvinceCountryRegion on Person.vStateProvinceCountryRegion


AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate on Production.BillOfMaterials

Indices SQL 2005 Adventure Works OLTP

AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate

Source code
Object type: Index

Clustered index.

Details

Table | Unique | Clustered | XML
Production.BillOfMaterials | Yes | Yes | No

Columns

Column | Description
ProductAssemblyID | Parent product identification number. Foreign key to Product.ProductID.
ComponentID | Component identification number. Foreign key to Product.ProductID.
StartDate | Date the component started being used in the assembly item.

Applies to

Indices | Unique | Clustered


IX_vProductAndDescription on Production.vProductAndDescription

Indices SQL 2005 Adventure Works OLTP

IX_vProductAndDescription

Source code
Object type: Index

Clustered index on the view vProductAndDescription.

Details

Data view | Unique | Clustered | XML
Production.vProductAndDescription | Yes | Yes | No

Columns

Column Description
CultureID
ProductID

Applies to

Indices | Unique | Clustered


IX_vStateProvinceCountryRegion on Person.vStateProvinceCountryRegion

Indices SQL 2005 Adventure Works OLTP

IX_vStateProvinceCountryRegion

Source code
Object type: Index

Clustered index on the view vStateProvinceCountryRegion.

Details

Data view | Unique | Clustered | XML
Person.vStateProvinceCountryRegion | Yes | Yes | No

Columns

Column Description
StateProvinceID
CountryRegionCode

Applies to

Indices | Unique | Clustered


SQL 2005 Adventure Works OLTP - Non clustered

Non clustered SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The indicies listed are not clustered.

AK_Address_rowguid on Person.Address
AK_AddressType_Name on Person.AddressType
AK_AddressType_rowguid on Person.AddressType
AK_Contact_rowguid on Person.Contact
AK_ContactType_Name on Person.ContactType
AK_CountryRegion_Name on Person.CountryRegion
AK_CreditCard_CardNumber on Sales.CreditCard
AK_Culture_Name on Production.Culture
AK_Currency_Name on Sales.Currency
AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode on Sales.CurrencyRate
AK_Customer_AccountNumber on Sales.Customer
AK_Customer_rowguid on Sales.Customer
AK_CustomerAddress_rowguid on Sales.CustomerAddress
AK_Department_Name on HumanResources.Department
AK_Document_FileName_Revision on Production.Document
AK_Employee_LoginID on HumanResources.Employee
AK_Employee_NationalIDNumber on HumanResources.Employee
AK_Employee_rowguid on HumanResources.Employee
AK_EmployeeAddress_rowguid on HumanResources.EmployeeAddress
AK_Location_Name on Production.Location
AK_Product_Name on Production.Product
AK_Product_ProductNumber on Production.Product
AK_Product_rowguid on Production.Product
AK_ProductCategory_Name on Production.ProductCategory
AK_ProductCategory_rowguid on Production.ProductCategory
AK_ProductDescription_rowguid on Production.ProductDescription
AK_ProductInventory_rowguid on Production.ProductInventory
AK_ProductModel_Name on Production.ProductModel
AK_ProductModel_rowguid on Production.ProductModel
AK_ProductProductPhoto_ProductID_ProductPhotoID on Production.ProductProductPhoto
AK_ProductSubcategory_Name on Production.ProductSubcategory
AK_ProductSubcategory_rowguid on Production.ProductSubcategory
AK_SalesOrderDetail_rowguid on Sales.SalesOrderDetail
AK_SalesOrderHeader_rowguid on Sales.SalesOrderHeader
AK_SalesOrderHeader_SalesOrderNumber on Sales.SalesOrderHeader
AK_SalesPerson_rowguid on Sales.SalesPerson
AK_SalesPersonQuotaHistory_rowguid on Sales.SalesPersonQuotaHistory
AK_SalesTaxRate_rowguid on Sales.SalesTaxRate
AK_SalesTaxRate_StateProvinceID_TaxType on Sales.SalesTaxRate
AK_SalesTerritory_Name on Sales.SalesTerritory
AK_SalesTerritory_rowguid on Sales.SalesTerritory
AK_SalesTerritoryHistory_rowguid on Sales.SalesTerritoryHistory
AK_ScrapReason_Name on Production.ScrapReason
AK_Shift_Name on HumanResources.Shift
AK_Shift_StartTime_EndTime on HumanResources.Shift
AK_ShipMethod_Name on Purchasing.ShipMethod
AK_ShipMethod_rowguid on Purchasing.ShipMethod
AK_SpecialOffer_rowguid on Sales.SpecialOffer
AK_SpecialOfferProduct_rowguid on Sales.SpecialOfferProduct
AK_StateProvince_Name on Person.StateProvince
AK_StateProvince_rowguid on Person.StateProvince
AK_StateProvince_StateProvinceCode_CountryRegionCode on Person.StateProvince
AK_Store_rowguid on Sales.Store
AK_StoreContact_rowguid on Sales.StoreContact
AK_UnitMeasure_Name on Production.UnitMeasure
AK_Vendor_AccountNumber on Purchasing.Vendor
IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode on Person.Address
IX_Address_StateProvinceID on Person.Address
IX_BillOfMaterials_UnitMeasureCode on Production.BillOfMaterials
IX_Contact_EmailAddress on Person.Contact
IX_CountryRegionCurrency_CurrencyCode on Sales.CountryRegionCurrency
IX_Customer_TerritoryID on Sales.Customer
IX_Employee_ManagerID on HumanResources.Employee
IX_EmployeeDepartmentHistory_DepartmentID on HumanResources.EmployeeDepartmentHistory
IX_EmployeeDepartmentHistory_ShiftID on HumanResources.EmployeeDepartmentHistory
IX_JobCandidate_EmployeeID on HumanResources.JobCandidate
IX_ProductInventory_ProductID on Production.ProductInventory
IX_ProductReview_ProductID_Name on Production.ProductReview
IX_ProductVendor_UnitMeasureCode on Purchasing.ProductVendor
IX_ProductVendor_VendorID on Purchasing.ProductVendor
IX_PurchaseOrderDetail_ProductID on Purchasing.PurchaseOrderDetail
IX_PurchaseOrderHeader_EmployeeID on Purchasing.PurchaseOrderHeader
IX_PurchaseOrderHeader_VendorID on Purchasing.PurchaseOrderHeader
IX_SalesOrderDetail_ProductID on Sales.SalesOrderDetail
IX_SalesOrderHeader_CustomerID on Sales.SalesOrderHeader
IX_SalesOrderHeader_SalesPersonID on Sales.SalesOrderHeader
IX_ShoppingCartItem_ShoppingCartID_ProductID on Sales.ShoppingCartItem
IX_SpecialOfferProduct_ProductID on Sales.SpecialOfferProduct
IX_Store_SalesPersonID on Sales.Store
IX_StoreContact_ContactID on Sales.StoreContact
IX_StoreContact_ContactTypeID on Sales.StoreContact
IX_TransactionHistory_ProductID on Production.TransactionHistory
IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID on Production.TransactionHistory
IX_TransactionHistoryArchive_ProductID on Production.TransactionHistoryArchive
IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID on Production.TransactionHistoryArchive
IX_VendorAddress_AddressID on Purchasing.VendorAddress
IX_VendorContact_ContactID on Purchasing.VendorContact
IX_VendorContact_ContactTypeID on Purchasing.VendorContact
IX_WorkOrder_ProductID on Production.WorkOrder
IX_WorkOrder_ScrapReasonID on Production.WorkOrder
IX_WorkOrderRouting_ProductID on Production.WorkOrderRouting
PXML_Contact_AddContact on Person.Contact
PXML_Individual_Demographics on Sales.Individual
PXML_ProductModel_CatalogDescription on Production.ProductModel
PXML_ProductModel_Instructions on Production.ProductModel
PXML_Store_Demographics on Sales.Store
XMLPATH_Individual_Demographics on Sales.Individual
XMLPROPERTY_Individual_Demographics on Sales.Individual
XMLVALUE_Individual_Demographics on Sales.Individual


AK_Address_rowguid on Person.Address

Indices SQL 2005 Adventure Works OLTP

AK_Address_rowguid

Source code
Object type: Index

Unique nonclustered index. Used to support replication samples.

Details

Table | Unique | Clustered | XML
Person.Address | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_AddressType_Name on Person.AddressType

Indices SQL 2005 Adventure Works OLTP

AK_AddressType_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Person.AddressType | Yes | No | No

Columns

Column | Description
Name | Address type description. For example, Billing, Home, or Shipping.

Applies to

Indices | Unique | Non clustered


AK_AddressType_rowguid on Person.AddressType

Indices SQL 2005 Adventure Works OLTP

AK_AddressType_rowguid

Source code
Object type: Index

Unique nonclustered index. Used to support replication samples.

Details

Table | Unique | Clustered | XML
Person.AddressType | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_Contact_rowguid on Person.Contact

Indices SQL 2005 Adventure Works OLTP

AK_Contact_rowguid

Source code
Object type: Index

Unique nonclustered index. Used to support replication samples.

Details

Table | Unique | Clustered | XML
Person.Contact | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ContactType_Name on Person.ContactType

Indices SQL 2005 Adventure Works OLTP

AK_ContactType_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Person.ContactType | Yes | No | No

Columns

Column | Description
Name | Contact type description.

Applies to

Indices | Unique | Non clustered


AK_CountryRegion_Name on Person.CountryRegion

Indices SQL 2005 Adventure Works OLTP

AK_CountryRegion_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Person.CountryRegion | Yes | No | No

Columns

Column | Description
Name | Country or region name.

Applies to

Indices | Unique | Non clustered


AK_CreditCard_CardNumber on Sales.CreditCard

Indices SQL 2005 Adventure Works OLTP

AK_CreditCard_CardNumber

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.CreditCard | Yes | No | No

Columns

Column | Description
CardNumber | Credit card number.

Applies to

Indices | Unique | Non clustered


AK_Culture_Name on Production.Culture

Indices SQL 2005 Adventure Works OLTP

AK_Culture_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.Culture | Yes | No | No

Columns

Column | Description
Name | Culture description.

Applies to

Indices | Unique | Non clustered


AK_Currency_Name on Sales.Currency

Indices SQL 2005 Adventure Works OLTP

AK_Currency_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.Currency | Yes | No | No

Columns

Column | Description
Name | Currency name.

Applies to

Indices | Unique | Non clustered


AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode on Sales.CurrencyRate

Indices SQL 2005 Adventure Works OLTP

AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.CurrencyRate | Yes | No | No

Columns

Column | Description
CurrencyRateDate | Date and time the exchange rate was obtained.
FromCurrencyCode | Exchange rate was converted from this currency code.
ToCurrencyCode | Exchange rate was converted to this currency code.

Applies to

Indices | Unique | Non clustered


AK_Customer_AccountNumber on Sales.Customer

Indices SQL 2005 Adventure Works OLTP

AK_Customer_AccountNumber

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.Customer | Yes | No | No

Columns

Column | Description
AccountNumber | Unique number identifying the customer assigned by the accounting system.

Applies to

Indices | Unique | Non clustered


AK_Customer_rowguid on Sales.Customer

Indices SQL 2005 Adventure Works OLTP

AK_Customer_rowguid

Source code
Object type: Index

Unique nonclustered index. Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.Customer | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_CustomerAddress_rowguid on Sales.CustomerAddress

Indices SQL 2005 Adventure Works OLTP

AK_CustomerAddress_rowguid

Source code
Object type: Index

Unique nonclustered index. Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.CustomerAddress | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_Department_Name on HumanResources.Department

Indices SQL 2005 Adventure Works OLTP

AK_Department_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.Department | Yes | No | No

Columns

Column | Description
Name | Name of the department.

Applies to

Indices | Unique | Non clustered


AK_Document_FileName_Revision on Production.Document

Indices SQL 2005 Adventure Works OLTP

AK_Document_FileName_Revision

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.Document | Yes | No | No

Columns

Column | Description
FileName | Directory path and file name of the document
Revision | Revision number of the document.

Applies to

Indices | Unique | Non clustered


AK_Employee_LoginID on HumanResources.Employee

Indices SQL 2005 Adventure Works OLTP

AK_Employee_LoginID

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.Employee | Yes | No | No

Columns

Column | Description
LoginID | Network login.

Applies to

Indices | Unique | Non clustered


AK_Employee_NationalIDNumber on HumanResources.Employee

Indices SQL 2005 Adventure Works OLTP

AK_Employee_NationalIDNumber

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.Employee | Yes | No | No

Columns

Column | Description
NationalIDNumber | Unique national identification number such as a social security number.

Applies to

Indices | Unique | Non clustered


AK_Employee_rowguid on HumanResources.Employee

Indices SQL 2005 Adventure Works OLTP

AK_Employee_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
HumanResources.Employee | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_EmployeeAddress_rowguid on HumanResources.EmployeeAddress

Indices SQL 2005 Adventure Works OLTP

AK_EmployeeAddress_rowguid

Source code
Object type: Index

Unique nonclustered index. Used to support replication samples.

Details

Table | Unique | Clustered | XML
HumanResources.EmployeeAddress | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_Location_Name on Production.Location

Indices SQL 2005 Adventure Works OLTP

AK_Location_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.Location | Yes | No | No

Columns

Column | Description
Name | Location description.

Applies to

Indices | Unique | Non clustered


AK_Product_Name on Production.Product

Indices SQL 2005 Adventure Works OLTP

AK_Product_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.Product | Yes | No | No

Columns

Column | Description
Name | Name of the product.

Applies to

Indices | Unique | Non clustered


AK_Product_ProductNumber on Production.Product

Indices SQL 2005 Adventure Works OLTP

AK_Product_ProductNumber

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.Product | Yes | No | No

Columns

Column | Description
ProductNumber | Unique product identification number.

Applies to

Indices | Unique | Non clustered


AK_Product_rowguid on Production.Product

Indices SQL 2005 Adventure Works OLTP

AK_Product_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Production.Product | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ProductCategory_Name on Production.ProductCategory

Indices SQL 2005 Adventure Works OLTP

AK_ProductCategory_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ProductCategory | Yes | No | No

Columns

Column | Description
Name | Category description.

Applies to

Indices | Unique | Non clustered


AK_ProductCategory_rowguid on Production.ProductCategory

Indices SQL 2005 Adventure Works OLTP

AK_ProductCategory_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Production.ProductCategory | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ProductDescription_rowguid on Production.ProductDescription

Indices SQL 2005 Adventure Works OLTP

AK_ProductDescription_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Production.ProductDescription | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ProductInventory_rowguid on Production.ProductInventory

Indices SQL 2005 Adventure Works OLTP

AK_ProductInventory_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Production.ProductInventory | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ProductModel_Name on Production.ProductModel

Indices SQL 2005 Adventure Works OLTP

AK_ProductModel_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ProductModel | Yes | No | No

Columns

Column | Description
Name | Product model description.

Applies to

Indices | Unique | Non clustered


AK_ProductModel_rowguid on Production.ProductModel

Indices SQL 2005 Adventure Works OLTP

AK_ProductModel_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Production.ProductModel | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ProductProductPhoto_ProductID_ProductPhotoID on Production.ProductProductPhoto

Indices SQL 2005 Adventure Works OLTP

AK_ProductProductPhoto_ProductID_ProductPhotoID

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ProductProductPhoto | Yes | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.
ProductPhotoID | Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.

Applies to

Indices | Unique | Non clustered


AK_ProductSubcategory_Name on Production.ProductSubcategory

Indices SQL 2005 Adventure Works OLTP

AK_ProductSubcategory_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ProductSubcategory | Yes | No | No

Columns

Column | Description
Name | Subcategory description.

Applies to

Indices | Unique | Non clustered


AK_ProductSubcategory_rowguid on Production.ProductSubcategory

Indices SQL 2005 Adventure Works OLTP

AK_ProductSubcategory_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Production.ProductSubcategory | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesOrderDetail_rowguid on Sales.SalesOrderDetail

Indices SQL 2005 Adventure Works OLTP

AK_SalesOrderDetail_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesOrderDetail | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesOrderHeader_rowguid on Sales.SalesOrderHeader

Indices SQL 2005 Adventure Works OLTP

AK_SalesOrderHeader_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesOrderHeader | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesOrderHeader_SalesOrderNumber on Sales.SalesOrderHeader

Indices SQL 2005 Adventure Works OLTP

AK_SalesOrderHeader_SalesOrderNumber

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.SalesOrderHeader | Yes | No | No

Columns

Column | Description
SalesOrderNumber | Unique sales order identification number.

Applies to

Indices | Unique | Non clustered


AK_SalesPerson_rowguid on Sales.SalesPerson

Indices SQL 2005 Adventure Works OLTP

AK_SalesPerson_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesPerson | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesPersonQuotaHistory_rowguid on Sales.SalesPersonQuotaHistory

Indices SQL 2005 Adventure Works OLTP

AK_SalesPersonQuotaHistory_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesPersonQuotaHistory | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesTaxRate_rowguid on Sales.SalesTaxRate

Indices SQL 2005 Adventure Works OLTP

AK_SalesTaxRate_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesTaxRate | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesTaxRate_StateProvinceID_TaxType on Sales.SalesTaxRate

Indices SQL 2005 Adventure Works OLTP

AK_SalesTaxRate_StateProvinceID_TaxType

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.SalesTaxRate | Yes | No | No

Columns

Column | Description
StateProvinceID | State, province, or country/region the sales tax applies to.
TaxType | 1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions.

Applies to

Indices | Unique | Non clustered


AK_SalesTerritory_Name on Sales.SalesTerritory

Indices SQL 2005 Adventure Works OLTP

AK_SalesTerritory_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.SalesTerritory | Yes | No | No

Columns

Column | Description
Name | Sales territory description

Applies to

Indices | Unique | Non clustered


AK_SalesTerritory_rowguid on Sales.SalesTerritory

Indices SQL 2005 Adventure Works OLTP

AK_SalesTerritory_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesTerritory | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SalesTerritoryHistory_rowguid on Sales.SalesTerritoryHistory

Indices SQL 2005 Adventure Works OLTP

AK_SalesTerritoryHistory_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SalesTerritoryHistory | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_ScrapReason_Name on Production.ScrapReason

Indices SQL 2005 Adventure Works OLTP

AK_ScrapReason_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ScrapReason | Yes | No | No

Columns

Column | Description
Name | Failure description.

Applies to

Indices | Unique | Non clustered


AK_Shift_Name on HumanResources.Shift

Indices SQL 2005 Adventure Works OLTP

AK_Shift_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.Shift | Yes | No | No

Columns

Column | Description
Name | Shift description.

Applies to

Indices | Unique | Non clustered


AK_Shift_StartTime_EndTime on HumanResources.Shift

Indices SQL 2005 Adventure Works OLTP

AK_Shift_StartTime_EndTime

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.Shift | Yes | No | No

Columns

Column | Description
StartTime | Shift start time.
EndTime | Shift end time.

Applies to

Indices | Unique | Non clustered


AK_ShipMethod_Name on Purchasing.ShipMethod

Indices SQL 2005 Adventure Works OLTP

AK_ShipMethod_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.ShipMethod | Yes | No | No

Columns

Column | Description
Name | Shipping company name.

Applies to

Indices | Unique | Non clustered


AK_ShipMethod_rowguid on Purchasing.ShipMethod

Indices SQL 2005 Adventure Works OLTP

AK_ShipMethod_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Purchasing.ShipMethod | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SpecialOffer_rowguid on Sales.SpecialOffer

Indices SQL 2005 Adventure Works OLTP

AK_SpecialOffer_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SpecialOffer | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_SpecialOfferProduct_rowguid on Sales.SpecialOfferProduct

Indices SQL 2005 Adventure Works OLTP

AK_SpecialOfferProduct_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.SpecialOfferProduct | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_StateProvince_Name on Person.StateProvince

Indices SQL 2005 Adventure Works OLTP

AK_StateProvince_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Person.StateProvince | Yes | No | No

Columns

Column | Description
Name | State or province description.

Applies to

Indices | Unique | Non clustered


AK_StateProvince_rowguid on Person.StateProvince

Indices SQL 2005 Adventure Works OLTP

AK_StateProvince_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Person.StateProvince | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_StateProvince_StateProvinceCode_CountryRegionCode on Person.StateProvince

Indices SQL 2005 Adventure Works OLTP

AK_StateProvince_StateProvinceCode_CountryRegionCode

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Person.StateProvince | Yes | No | No

Columns

Column | Description
StateProvinceCode | ISO standard state or province code.
CountryRegionCode | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode.

Applies to

Indices | Unique | Non clustered


AK_Store_rowguid on Sales.Store

Indices SQL 2005 Adventure Works OLTP

AK_Store_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.Store | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_StoreContact_rowguid on Sales.StoreContact

Indices SQL 2005 Adventure Works OLTP

AK_StoreContact_rowguid

Source code
Object type: Index

Unique nonclustered index.Used to support replication samples.

Details

Table | Unique | Clustered | XML
Sales.StoreContact | Yes | No | No

Columns

Column | Description
rowguid | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

Applies to

Indices | Unique | Non clustered


AK_UnitMeasure_Name on Production.UnitMeasure

Indices SQL 2005 Adventure Works OLTP

AK_UnitMeasure_Name

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Production.UnitMeasure | Yes | No | No

Columns

Column | Description
Name | Unit of measure description.

Applies to

Indices | Unique | Non clustered


AK_Vendor_AccountNumber on Purchasing.Vendor

Indices SQL 2005 Adventure Works OLTP

AK_Vendor_AccountNumber

Source code
Object type: Index

Unique nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.Vendor | Yes | No | No

Columns

Column | Description
AccountNumber | Vendor account (identification) number.

Applies to

Indices | Unique | Non clustered


IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode on Person.Address

Indices SQL 2005 Adventure Works OLTP

IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Person.Address | Yes | No | No

Columns

Column | Description
AddressLine1 | First street address line.
AddressLine2 | Second street address line.
City | Name of the city.
StateProvinceID | Unique identification number for the state or province. Foreign key to StateProvince table.
PostalCode | Postal code for the street address.

Applies to

Indices | Unique | Non clustered


IX_Address_StateProvinceID on Person.Address

Indices SQL 2005 Adventure Works OLTP

IX_Address_StateProvinceID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Person.Address | No | No | No

Columns

Column | Description
StateProvinceID | Unique identification number for the state or province. Foreign key to StateProvince table.

Applies to

Indices | Non clustered


IX_BillOfMaterials_UnitMeasureCode on Production.BillOfMaterials

Indices SQL 2005 Adventure Works OLTP

IX_BillOfMaterials_UnitMeasureCode

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.BillOfMaterials | No | No | No

Columns

Column | Description
UnitMeasureCode | Standard code identifying the unit of measure for the quantity.

Applies to

Indices | Non clustered


IX_Contact_EmailAddress on Person.Contact

Indices SQL 2005 Adventure Works OLTP

IX_Contact_EmailAddress

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Person.Contact | No | No | No

Columns

Column | Description
EmailAddress | E-mail address for the person.

Applies to

Indices | Non clustered


IX_CountryRegionCurrency_CurrencyCode on Sales.CountryRegionCurrency

Indices SQL 2005 Adventure Works OLTP

IX_CountryRegionCurrency_CurrencyCode

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.CountryRegionCurrency | No | No | No

Columns

Column | Description
CurrencyCode | ISO standard currency code. Foreign key to Currency.CurrencyCode.

Applies to

Indices | Non clustered


IX_Customer_TerritoryID on Sales.Customer

Indices SQL 2005 Adventure Works OLTP

IX_Customer_TerritoryID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.Customer | No | No | No

Columns

Column | Description
TerritoryID | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.

Applies to

Indices | Non clustered


IX_Employee_ManagerID on HumanResources.Employee

Indices SQL 2005 Adventure Works OLTP

IX_Employee_ManagerID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.Employee | No | No | No

Columns

Column | Description
ManagerID | Manager to whom the employee is assigned. Foreign Key to Employee.M

Applies to

Indices | Non clustered


IX_EmployeeDepartmentHistory_DepartmentID on HumanResources.EmployeeDepartmentHistory

Indices SQL 2005 Adventure Works OLTP

IX_EmployeeDepartmentHistory_DepartmentID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.EmployeeDepartmentHistory | No | No | No

Columns

Column | Description
DepartmentID | Department in which the employee worked including currently. Foreign key to Department.DepartmentID.

Applies to

Indices | Non clustered


IX_EmployeeDepartmentHistory_ShiftID on HumanResources.EmployeeDepartmentHistory

Indices SQL 2005 Adventure Works OLTP

IX_EmployeeDepartmentHistory_ShiftID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.EmployeeDepartmentHistory | No | No | No

Columns

Column | Description
ShiftID | Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.

Applies to

Indices | Non clustered


IX_JobCandidate_EmployeeID on HumanResources.JobCandidate

Indices SQL 2005 Adventure Works OLTP

IX_JobCandidate_EmployeeID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
HumanResources.JobCandidate | No | No | No

Columns

Column | Description
EmployeeID | Employee identification number if applicant was hired. Foreign key to Employee.EmployeeID.

Applies to

Indices | Non clustered


IX_ProductInventory_ProductID on Production.ProductInventory

Indices SQL 2005 Adventure Works OLTP

IX_ProductInventory_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ProductInventory | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_ProductReview_ProductID_Name on Production.ProductReview

Indices SQL 2005 Adventure Works OLTP

IX_ProductReview_ProductID_Name

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.ProductReview | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.
ReviewerName | Name of the reviewer.

Applies to

Indices | Non clustered


IX_ProductVendor_UnitMeasureCode on Purchasing.ProductVendor

Indices SQL 2005 Adventure Works OLTP

IX_ProductVendor_UnitMeasureCode

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.ProductVendor | No | No | No

Columns

Column | Description
UnitMeasureCode | The product's unit of measure.

Applies to

Indices | Non clustered


IX_ProductVendor_VendorID on Purchasing.ProductVendor

Indices SQL 2005 Adventure Works OLTP

IX_ProductVendor_VendorID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.ProductVendor | No | No | No

Columns

Column | Description
VendorID | Primary key. Foreign key to Vendor.VendorID.

Applies to

Indices | Non clustered


IX_PurchaseOrderDetail_ProductID on Purchasing.PurchaseOrderDetail

Indices SQL 2005 Adventure Works OLTP

IX_PurchaseOrderDetail_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.PurchaseOrderDetail | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_PurchaseOrderHeader_EmployeeID on Purchasing.PurchaseOrderHeader

Indices SQL 2005 Adventure Works OLTP

IX_PurchaseOrderHeader_EmployeeID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.PurchaseOrderHeader | No | No | No

Columns

Column | Description
EmployeeID | Employee who created the purchase order. Foreign key to Employee.EmployeeID.

Applies to

Indices | Non clustered


IX_PurchaseOrderHeader_VendorID on Purchasing.PurchaseOrderHeader

Indices SQL 2005 Adventure Works OLTP

IX_PurchaseOrderHeader_VendorID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.PurchaseOrderHeader | No | No | No

Columns

Column | Description
VendorID | Vendor with whom the purchase order is placed. Foreign key to Vendor.VendorID.

Applies to

Indices | Non clustered


IX_SalesOrderDetail_ProductID on Sales.SalesOrderDetail

Indices SQL 2005 Adventure Works OLTP

IX_SalesOrderDetail_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.SalesOrderDetail | No | No | No

Columns

Column | Description
ProductID | Product sold to customer. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_SalesOrderHeader_CustomerID on Sales.SalesOrderHeader

Indices SQL 2005 Adventure Works OLTP

IX_SalesOrderHeader_CustomerID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.SalesOrderHeader | No | No | No

Columns

Column | Description
CustomerID | Customer identification number. Foreign key to Customer.CustomerID.

Applies to

Indices | Non clustered


IX_SalesOrderHeader_SalesPersonID on Sales.SalesOrderHeader

Indices SQL 2005 Adventure Works OLTP

IX_SalesOrderHeader_SalesPersonID

Source code
Object type: Index

Nonclustered index.>

Details

Table | Unique | Clustered | XML
Sales.SalesOrderHeader | No | No | No

Columns

Column | Description
SalesPersonID | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.

Applies to

Indices | Non clustered


IX_ShoppingCartItem_ShoppingCartID_ProductID on Sales.ShoppingCartItem

Indices SQL 2005 Adventure Works OLTP

IX_ShoppingCartItem_ShoppingCartID_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.ShoppingCartItem | No | No | No

Columns

Column | Description
ShoppingCartID | Shopping cart identification number.
ProductID | Product ordered. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_SpecialOfferProduct_ProductID on Sales.SpecialOfferProduct

Indices SQL 2005 Adventure Works OLTP

IX_SpecialOfferProduct_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.SpecialOfferProduct | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_Store_SalesPersonID on Sales.Store

Indices SQL 2005 Adventure Works OLTP

IX_Store_SalesPersonID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.Store | No | No | No

Columns

Column | Description
SalesPersonID | ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID.

Applies to

Indices | Non clustered


IX_StoreContact_ContactID on Sales.StoreContact

Indices SQL 2005 Adventure Works OLTP

IX_StoreContact_ContactID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.StoreContact | No | No | No

Columns

Column | Description
ContactID | Contact (store employee) identification number. Foreign key to Contact.ContactID.

Applies to

Indices | Non clustered


IX_StoreContact_ContactTypeID on Sales.StoreContact

Indices SQL 2005 Adventure Works OLTP

IX_StoreContact_ContactTypeID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Sales.StoreContact | No | No | No

Columns

Column | Description
ContactTypeID | Contact type such as owner or purchasing agent. Foreign key to ContactType.ContactTypeID.

Applies to

Indices | Non clustered


IX_TransactionHistory_ProductID on Production.TransactionHistory

Indices SQL 2005 Adventure Works OLTP

IX_TransactionHistory_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.TransactionHistory | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID on Production.TransactionHistory

Indices SQL 2005 Adventure Works OLTP

IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID

Source code
Object type: Index

Nonclustered index.>

Details

Table | Unique | Clustered | XML
Production.TransactionHistory | No | No | No

Columns

Column | Description
ReferenceOrderID | Purchase order, sales order, or work order identification number.
ReferenceOrderLineID | Line number associated with the purchase order, sales order, or work order.

Applies to

Indices | Non clustered


IX_TransactionHistoryArchive_ProductID on Production.TransactionHistoryArchive

Indices SQL 2005 Adventure Works OLTP

IX_TransactionHistoryArchive_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.TransactionHistoryArchive | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID on Production.TransactionHistoryArchive

Indices SQL 2005 Adventure Works OLTP

IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.TransactionHistoryArchive | No | No | No

Columns

Column | Description
ReferenceOrderID | Purchase order, sales order, or work order identification number.
ReferenceOrderLineID | Line number associated with the purchase order, sales order, or work order.

Applies to

Indices | Non clustered


IX_VendorAddress_AddressID on Purchasing.VendorAddress

Indices SQL 2005 Adventure Works OLTP

IX_VendorAddress_AddressID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.VendorAddress | No | No | No

Columns

Column | Description
AddressID | Primary key. Foreign key to Address.AddressID.

Applies to

Indices | Non clustered


IX_VendorContact_ContactID on Purchasing.VendorContact

Indices SQL 2005 Adventure Works OLTP

IX_VendorContact_ContactID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.VendorContact | No | No | No

Columns

Column | Description
ContactID | Contact (Vendor employee) identification number. Foreign key to Contact.ContactID.

Applies to

Indices | Non clustered


IX_VendorContact_ContactTypeID on Purchasing.VendorContact

Indices SQL 2005 Adventure Works OLTP

IX_VendorContact_ContactTypeID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Purchasing.VendorContact | No | No | No

Columns

Column | Description
ContactTypeID | Contact type such as sales manager, or sales agent.

Applies to

Indices | Non clustered


IX_WorkOrder_ProductID on Production.WorkOrder

Indices SQL 2005 Adventure Works OLTP

IX_WorkOrder_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.WorkOrder | No | No | No

Columns

Column | Description
ProductID | Product identification number. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


IX_WorkOrder_ScrapReasonID on Production.WorkOrder

Indices SQL 2005 Adventure Works OLTP

IX_WorkOrder_ScrapReasonID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.WorkOrder | No | No | No

Columns

Column | Description
ScrapReasonID | Reason for inspection failure.

Applies to

Indices | Non clustered


IX_WorkOrderRouting_ProductID on Production.WorkOrderRouting

Indices SQL 2005 Adventure Works OLTP

IX_WorkOrderRouting_ProductID

Source code
Object type: Index

Nonclustered index.

Details

Table | Unique | Clustered | XML
Production.WorkOrderRouting | No | No | No

Columns

Column | Description
ProductID | Primary key. Foreign key to Product.ProductID.

Applies to

Indices | Non clustered


PXML_Contact_AddContact on Person.Contact

Indices SQL 2005 Adventure Works OLTP

PXML_Contact_AddContact

Source code
Object type: Index

Primary XML index.

Details

Table | Unique | Clustered | XML
Person.Contact | No | No | Yes

Columns

Column | Description
AdditionalContactInfo | Additional contact information about the person stored in xml format.

Applies to

Indices | Non clustered | XML


PXML_Individual_Demographics on Sales.Individual

Indices SQL 2005 Adventure Works OLTP

PXML_Individual_Demographics

Source code
Object type: Index

Primary XML index.

Details

Table | Unique | Clustered | XML
Sales.Individual | No | No | Yes

Columns

Column | Description
Demographics | Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.

Applies to

Indices | Non clustered | XML


PXML_ProductModel_CatalogDescription on Production.ProductModel

Indices SQL 2005 Adventure Works OLTP

PXML_ProductModel_CatalogDescription

Source code
Object type: Index

Primary XML index.

Details

Table | Unique | Clustered | XML
Production.ProductModel | No | No | Yes

Columns

Column | Description
CatalogDescription | Detailed product catalog information in xml format.

Applies to

Indices | Non clustered | XML


PXML_ProductModel_Instructions on Production.ProductModel

Indices SQL 2005 Adventure Works OLTP

PXML_ProductModel_Instructions

Source code
Object type: Index

Primary XML index.

Details

Table | Unique | Clustered | XML
Production.ProductModel | No | No | Yes

Columns

Column | Description
Instructions | Manufacturing instructions in xml format.

Applies to

Indices | Non clustered | XML


PXML_Store_Demographics on Sales.Store

Indices SQL 2005 Adventure Works OLTP

PXML_Store_Demographics

Source code
Object type: Index

Primary XML index.

Details

Table | Unique | Clustered | XML
Sales.Store | No | No | Yes

Columns

Column | Description
Demographics | Demographic informationg about the store such as the number of employees, annual sales and store type.

Applies to

Indices | Non clustered | XML


XMLPATH_Individual_Demographics on Sales.Individual

Indices SQL 2005 Adventure Works OLTP

XMLPATH_Individual_Demographics

Source code
Object type: Index

Secondary XML index for path.

Details

Table | Unique | Clustered | XML
Sales.Individual | No | No | Yes

Columns

Column | Description
Demographics | Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.

Applies to

Indices | Non clustered | XML


XMLPROPERTY_Individual_Demographics on Sales.Individual

Indices SQL 2005 Adventure Works OLTP

XMLPROPERTY_Individual_Demographics

Source code
Object type: Index

Secondary XML index for property.

Details

Table | Unique | Clustered | XML
Sales.Individual | No | No | Yes

Columns

Column | Description
Demographics | Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.

Applies to

Indices | Non clustered | XML


XMLVALUE_Individual_Demographics on Sales.Individual

Indices SQL 2005 Adventure Works OLTP

XMLVALUE_Individual_Demographics

Source code
Object type: Index

Secondary XML index for value.

Details

Table | Unique | Clustered | XML
Sales.Individual | No | No | Yes

Columns

Column | Description
Demographics | Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.

Applies to

Indices | Non clustered | XML


SQL 2005 Adventure Works OLTP - Unique

Unique SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The indicies listed are all unique indicies.

AK_Address_rowguid on Person.Address
AK_AddressType_Name on Person.AddressType
AK_AddressType_rowguid on Person.AddressType
AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate on Production.BillOfMaterials
AK_Contact_rowguid on Person.Contact
AK_ContactType_Name on Person.ContactType
AK_CountryRegion_Name on Person.CountryRegion
AK_CreditCard_CardNumber on Sales.CreditCard
AK_Culture_Name on Production.Culture
AK_Currency_Name on Sales.Currency
AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode on Sales.CurrencyRate
AK_Customer_AccountNumber on Sales.Customer
AK_Customer_rowguid on Sales.Customer
AK_CustomerAddress_rowguid on Sales.CustomerAddress
AK_Department_Name on HumanResources.Department
AK_Document_FileName_Revision on Production.Document
AK_Employee_LoginID on HumanResources.Employee
AK_Employee_NationalIDNumber on HumanResources.Employee
AK_Employee_rowguid on HumanResources.Employee
AK_EmployeeAddress_rowguid on HumanResources.EmployeeAddress
AK_Location_Name on Production.Location
AK_Product_Name on Production.Product
AK_Product_ProductNumber on Production.Product
AK_Product_rowguid on Production.Product
AK_ProductCategory_Name on Production.ProductCategory
AK_ProductCategory_rowguid on Production.ProductCategory
AK_ProductDescription_rowguid on Production.ProductDescription
AK_ProductInventory_rowguid on Production.ProductInventory
AK_ProductModel_Name on Production.ProductModel
AK_ProductModel_rowguid on Production.ProductModel
AK_ProductProductPhoto_ProductID_ProductPhotoID on Production.ProductProductPhoto
AK_ProductSubcategory_Name on Production.ProductSubcategory
AK_ProductSubcategory_rowguid on Production.ProductSubcategory
AK_SalesOrderDetail_rowguid on Sales.SalesOrderDetail
AK_SalesOrderHeader_rowguid on Sales.SalesOrderHeader
AK_SalesOrderHeader_SalesOrderNumber on Sales.SalesOrderHeader
AK_SalesPerson_rowguid on Sales.SalesPerson
AK_SalesPersonQuotaHistory_rowguid on Sales.SalesPersonQuotaHistory
AK_SalesTaxRate_rowguid on Sales.SalesTaxRate
AK_SalesTaxRate_StateProvinceID_TaxType on Sales.SalesTaxRate
AK_SalesTerritory_Name on Sales.SalesTerritory
AK_SalesTerritory_rowguid on Sales.SalesTerritory
AK_SalesTerritoryHistory_rowguid on Sales.SalesTerritoryHistory
AK_ScrapReason_Name on Production.ScrapReason
AK_Shift_Name on HumanResources.Shift
AK_Shift_StartTime_EndTime on HumanResources.Shift
AK_ShipMethod_Name on Purchasing.ShipMethod
AK_ShipMethod_rowguid on Purchasing.ShipMethod
AK_SpecialOffer_rowguid on Sales.SpecialOffer
AK_SpecialOfferProduct_rowguid on Sales.SpecialOfferProduct
AK_StateProvince_Name on Person.StateProvince
AK_StateProvince_rowguid on Person.StateProvince
AK_StateProvince_StateProvinceCode_CountryRegionCode on Person.StateProvince
AK_Store_rowguid on Sales.Store
AK_StoreContact_rowguid on Sales.StoreContact
AK_UnitMeasure_Name on Production.UnitMeasure
AK_Vendor_AccountNumber on Purchasing.Vendor
IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode on Person.Address
IX_vProductAndDescription on Production.vProductAndDescription
IX_vStateProvinceCountryRegion on Person.vStateProvinceCountryRegion


SQL 2005 Adventure Works OLTP - XML

XML SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The indicies listed are on XML data columns.

PXML_Contact_AddContact on Person.Contact
PXML_Individual_Demographics on Sales.Individual
PXML_ProductModel_CatalogDescription on Production.ProductModel
PXML_ProductModel_Instructions on Production.ProductModel
PXML_Store_Demographics on Sales.Store
XMLPATH_Individual_Demographics on Sales.Individual
XMLPROPERTY_Individual_Demographics on Sales.Individual
XMLVALUE_Individual_Demographics on Sales.Individual


SQL 2005 Adventure Works OLTP - Tables

Tables SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following tables are defined for this database.

dbo.AWBuildVersion
dbo.DatabaseLog
HumanResources.Department
HumanResources.Employee
HumanResources.EmployeeAddress
HumanResources.EmployeeDepartmentHistory
HumanResources.EmployeePayHistory
HumanResources.JobCandidate
HumanResources.Shift
Person.Address
Person.AddressType
Person.Contact
Person.ContactType
Person.CountryRegion
Person.StateProvince
Production.BillOfMaterials
Production.Culture
Production.Document
Production.Illustration
Production.Location
Production.Product
Production.ProductCategory
Production.ProductCostHistory
Production.ProductDescription
Production.ProductDocument
Production.ProductInventory
Production.ProductListPriceHistory
Production.ProductModel
Production.ProductModelIllustration
Production.ProductModelProductDescriptionCulture
Production.ProductPhoto
Production.ProductProductPhoto
Production.ProductReview
Production.ProductSubcategory
Production.ScrapReason
Production.TransactionHistory
Production.TransactionHistoryArchive
Production.UnitMeasure
Production.WorkOrder
Production.WorkOrderRouting
Purchasing.ProductVendor
Purchasing.PurchaseOrderDetail
Purchasing.PurchaseOrderHeader
Purchasing.ShipMethod
Purchasing.Vendor
Purchasing.VendorAddress
Purchasing.VendorContact
Sales.ContactCreditCard
Sales.CountryRegionCurrency
Sales.CreditCard
Sales.Currency
Sales.CurrencyRate
Sales.Customer
Sales.CustomerAddress
Sales.Individual
Sales.SalesOrderDetail
Sales.SalesOrderHeader
Sales.SalesOrderHeaderSalesReason
Sales.SalesPerson
Sales.SalesPersonQuotaHistory
Sales.SalesReason
Sales.SalesTaxRate
Sales.SalesTerritory
Sales.SalesTerritoryHistory
Sales.ShoppingCartItem
Sales.SpecialOffer
Sales.SpecialOfferProduct
Sales.Store
Sales.StoreContact


SQL 2005 Adventure Works OLTP - User

User SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The tables listed are all stored in the physical database.

dbo.AWBuildVersion
dbo.DatabaseLog
HumanResources.Department
HumanResources.Employee
HumanResources.EmployeeAddress
HumanResources.EmployeeDepartmentHistory
HumanResources.EmployeePayHistory
HumanResources.JobCandidate
HumanResources.Shift
Person.Address
Person.AddressType
Person.Contact
Person.ContactType
Person.CountryRegion
Person.StateProvince
Production.BillOfMaterials
Production.Culture
Production.Document
Production.Illustration
Production.Location
Production.Product
Production.ProductCategory
Production.ProductCostHistory
Production.ProductDescription
Production.ProductDocument
Production.ProductInventory
Production.ProductListPriceHistory
Production.ProductModel
Production.ProductModelIllustration
Production.ProductModelProductDescriptionCulture
Production.ProductPhoto
Production.ProductProductPhoto
Production.ProductReview
Production.ProductSubcategory
Production.ScrapReason
Production.TransactionHistory
Production.TransactionHistoryArchive
Production.UnitMeasure
Production.WorkOrder
Production.WorkOrderRouting
Purchasing.ProductVendor
Purchasing.PurchaseOrderDetail
Purchasing.PurchaseOrderHeader
Purchasing.ShipMethod
Purchasing.Vendor
Purchasing.VendorAddress
Purchasing.VendorContact
Sales.ContactCreditCard
Sales.CountryRegionCurrency
Sales.CreditCard
Sales.Currency
Sales.CurrencyRate
Sales.Customer
Sales.CustomerAddress
Sales.Individual
Sales.SalesOrderDetail
Sales.SalesOrderHeader
Sales.SalesOrderHeaderSalesReason
Sales.SalesPerson
Sales.SalesPersonQuotaHistory
Sales.SalesReason
Sales.SalesTaxRate
Sales.SalesTerritory
Sales.SalesTerritoryHistory
Sales.ShoppingCartItem
Sales.SpecialOffer
Sales.SpecialOfferProduct
Sales.Store
Sales.StoreContact


dbo.AWBuildVersion

Source code
Object type: Table

Current version number of the AdventureWorks sample database.

Columns

Name | Data type | Nullable | Description
SystemInformationID tinyint No Column has identity seed value of 1 with a step value of 1.
Primary key for AWBuildVersion records.
Database Version | nvarchar(25) | No | Version number of the database in 9.yy.mm.dd.00 format.
VersionDate | datetime | No | Date and time the record was last updated.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_AWBuildVersion_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_AWBuildVersion_SystemInformationID | PRIMARY KEY | SystemInformationID | Clustered index created by a primary key constraint.

Triggers

Name | Description
dbo.uAWBuildVersion | AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.

Modified by

Name | Description
dbo.uAWBuildVersion | AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.

Applies to

Tables | User


dbo.DatabaseLog

Source code
Object type: Table

Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog.

Columns

Name | Data type | Nullable | Description
DatabaseLogID int No Column has identity seed value of 1 with a step value of 1.
Primary key for DatabaseLog records.
PostTime | datetime | No | The date and time the DDL change occurred.
DatabaseUser | sysname | No | The user who implemented the DDL change.
Event | sysname | No | The type of DDL statement that was executed.
Schema | sysname | Yes | The schema to which the changed object belongs.
Object | sysname | Yes | The object that was changed by the DDL statment.
TSQL | nvarchar(max) | No | The exact Transact-SQL statement that was executed.
XmlEvent | xml | No | The raw XML data generated by database trigger.

Modified by

Name Description
ddlDatabaseTriggerLog

Applies to

Tables | User


HumanResources.Department

Source code
Object type: Table

Lookup table containing the departments within the Adventure Works Cycles company.

Columns

Name | Data type | Nullable | Description
DepartmentID smallint No Column has identity seed value of 1 with a step value of 1.
Primary key for Department records.
Name | Name | No | Name of the department.
GroupName | Name | No | Name of the group to which the department belongs.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Department_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Department_DepartmentID | PRIMARY KEY | DepartmentID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Department_Name | Unique nonclustered index.

Triggers

Name | Description
HumanResources.uDepartment | AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.

Linked tables

Name | Description
HumanResources.EmployeeDepartmentHistory | Employee department transfers.

Accessed by

Name | Description
HumanResources.vEmployeeDepartment | Returns employee name, title, and current department.
HumanResources.vEmployeeDepartmentHistory | Returns employee name and current and previous departments.

Modified by

Name | Description
HumanResources.uDepartment | AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.

Applies to

Tables | User


HumanResources.Employee

Source code
Object type: Table

Employee information such as salary, department, and title.

Columns

Name | Data type | Nullable | Description
EmployeeID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Employee records.
NationalIDNumber | nvarchar(15) | No | Unique national identification number such as a social security number.
ContactID | int | No | Identifies the employee in the Contact table. Foreign key to Contact.ContactID.
LoginID | nvarchar(256) | No | Network login.
ManagerID | int | Yes | Manager to whom the employee is assigned. Foreign Key to Employee.M
Title | nvarchar(50) | No | Work title such as Buyer or Sales Representative.
BirthDate | datetime | No | Date of birth.
MaritalStatus | nchar(1) | No | M = Married, S = Single
Gender | nchar(1) | No | M = Male, F = Female
HireDate | datetime | No | Employee hired on this date.
SalariedFlag Flag No Default value: 1
Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining.
VacationHours smallint No Default value: 0
Number of available vacation hours.
SickLeaveHours smallint No Default value: 0
Number of available sick leave hours.
CurrentFlag Flag No Default value: 1
0 = Inactive, 1 = Active
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Employee_SalariedFlag DEFAULT SalariedFlag Value: 1
Default constraint value of 1 (TRUE)
DF_Employee_VacationHours DEFAULT VacationHours Value: 0
Default constraint value of 0
DF_Employee_SickLeaveHours DEFAULT SickLeaveHours Value: 0
Default constraint value of 0
DF_Employee_CurrentFlag DEFAULT CurrentFlag Value: 1
Default constraint value of 1
DF_Employee_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_Employee_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Employee_BirthDate CHECK N/A Value: ([BirthDate] BETWEEN '1930-01-01' AND DATEADD(YEAR, -18, GETDATE() ) )
Check constraint [BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),GETDATE())
CK_Employee_MaritalStatus CHECK N/A Value: (UPPER([MaritalStatus]) IN ('M', 'S') )
Check constraint [MaritalStatus]='s' OR [MaritalStatus]='m' OR [MaritalStatus]='S' OR [MaritalStatus]='M'
CK_Employee_HireDate CHECK N/A Value: ([HireDate] BETWEEN '1996-07-01' AND DATEADD(DAY, 1, GETDATE() ) )
Check constraint [HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),GETDATE())
CK_Employee_Gender CHECK N/A Value: (UPPER([Gender]) IN ('M', 'F') )
Check constraint [Gender]='f' OR [Gender]='m' OR [Gender]='F' OR [Gender]='M'
CK_Employee_VacationHours CHECK N/A Value: ([VacationHours] BETWEEN -40 AND 240)
Check constraint [VacationHours]>=(-40) AND [VacationHours]<=(240)
CK_Employee_SickLeaveHours CHECK N/A Value: ([SickLeaveHours] BETWEEN 0 AND 120)
Check constraint [SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120)
PK_Employee_EmployeeID | PRIMARY KEY | EmployeeID | Clustered index created by a primary key constraint.
FK_Employee_Employee_ManagerID FOREIGN KEY ManagerID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.ManagerID.
FK_Employee_Contact_ContactID FOREIGN KEY ContactID Reference table: Person.Contact
Foreign key constraint referencing Contact.ContactID.

Indices

Name | Description
AK_Employee_LoginID | Unique nonclustered index.
AK_Employee_NationalIDNumber | Unique nonclustered index.
AK_Employee_rowguid | Unique nonclustered index.Used to support replication samples.
IX_Employee_ManagerID | Nonclustered index.

Triggers

Name | Description
HumanResources.dEmployee | INSTEAD OF DELETE trigger which keeps Employees from being deleted.
HumanResources.uEmployee | AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.

Linked tables

Name | Description
HumanResources.Employee | Employee information such as salary, department, and title.
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).
HumanResources.EmployeeDepartmentHistory | Employee department transfers.
HumanResources.EmployeePayHistory | Employee pay history.
HumanResources.JobCandidate | Résumés submitted to Human Resources by job applicants.
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.
Sales.SalesPerson | Sales representative current information.

Accessed by

Name | Description
dbo.ufnGetContactInformation | Table value function returning the first name, last name, job title and contact type for a given contact.
dbo.uspGetEmployeeManagers | Stored procedure using a recursive query to return the direct and indirect managers of the specified employee.
dbo.uspGetManagerEmployees | Stored procedure using a recursive query to return the direct and indirect employees of the specified manager.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
HumanResources.vEmployee | Employee names and addresses.
HumanResources.vEmployeeDepartment | Returns employee name, title, and current department.
HumanResources.vEmployeeDepartmentHistory | Returns employee name and current and previous departments.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vSalesPersonSalesByFiscalYears | Uses PIVOT to return aggregated sales information for each sales representative.
Territory Sales Drilldown | Adventure Works sales by territory. This report drills down through salesperson and order number with drillthrough to individual orders. This report illustrates the use of a table data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of drillthrough links and conditional formatting.

Modified by

Name | Description
HumanResources.uEmployee | AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.
HumanResources.uspUpdateEmployeeHireInfo | Updates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.
HumanResources.uspUpdateEmployeeLogin | Updates the Employee table with the values specified in the input parameters for the given EmployeeID.
HumanResources.uspUpdateEmployeePersonalInfo | Updates the Employee table with the values specified in the input parameters for the given EmployeeID.

Applies to

Tables | User


HumanResources.EmployeeAddress

Source code
Object type: Table

Cross-reference table mapping employees to their address(es).

Columns

Name | Data type | Nullable | Description
EmployeeID | int | No | Primary key. Foreign key to Employee.EmployeeID.
AddressID | int | No | Primary key. Foreign key to Address.AddressID.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_EmployeeAddress_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_EmployeeAddress_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_EmployeeAddress_EmployeeID_AddressID PRIMARY KEY EmployeeID
AddressID 		Clustered index created by a primary key constraint.
FK_EmployeeAddress_Address_AddressID FOREIGN KEY AddressID Reference table: Person.Address
Foreign key constraint referencing Address.AddressID.
FK_EmployeeAddress_Employee_EmployeeID FOREIGN KEY EmployeeID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.EmployeeID.

Indices

Name | Description
AK_EmployeeAddress_rowguid | Unique nonclustered index. Used to support replication samples.

Triggers

Name | Description
HumanResources.uEmployeeAddress | AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.

Accessed by

Name | Description
HumanResources.vEmployee | Employee names and addresses.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.

Modified by

Name | Description
HumanResources.uEmployeeAddress | AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.

Applies to

Tables | User


HumanResources.EmployeeDepartmentHistory

Source code
Object type: Table

Employee department transfers.

Columns

Name | Data type | Nullable | Description
EmployeeID | int | No | Employee identification number. Foreign key to Employee.EmployeeID.
DepartmentID | smallint | No | Department in which the employee worked including currently. Foreign key to Department.DepartmentID.
ShiftID | tinyint | No | Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.
StartDate | datetime | No | Date the employee started work in the department.
EndDate | datetime | Yes | Date the employee left the department. NULL = Current department.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_EmployeeDepartmentHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_EmployeeDepartmentHistory_EndDate CHECK N/A Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NUL
PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID PRIMARY KEY EmployeeID
StartDate
DepartmentID
ShiftID 		Clustered index created by a primary key constraint.
FK_EmployeeDepartmentHistory_Department_DepartmentID FOREIGN KEY DepartmentID Reference table: HumanResources.Department
Foreign key constraint referencing Department.DepartmentID.
FK_EmployeeDepartmentHistory_Employee_EmployeeID FOREIGN KEY EmployeeID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.EmployeeID.
FK_EmployeeDepartmentHistory_Shift_ShiftID FOREIGN KEY ShiftID Reference table: HumanResources.Shift
Foreign key constraint referencing Shift.ShiftID

Indices

Name | Description
IX_EmployeeDepartmentHistory_DepartmentID | Nonclustered index.
IX_EmployeeDepartmentHistory_ShiftID | Nonclustered index.

Triggers

Name | Description
HumanResources.uEmployeeDepartmentHistory | AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.

Accessed by

Name | Description
HumanResources.vEmployeeDepartment | Returns employee name, title, and current department.
HumanResources.vEmployeeDepartmentHistory | Returns employee name and current and previous departments.

Modified by

Name | Description
HumanResources.uEmployeeDepartmentHistory | AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.

Applies to

Tables | User


HumanResources.EmployeePayHistory

Source code
Object type: Table

Employee pay history.

Columns

Name | Data type | Nullable | Description
EmployeeID | int | No | Employee identification number. Foreign key to Employee.EmployeeID.
RateChangeDate | datetime | No | Date the change in pay is effective
Rate | money | No | Salary hourly rate.
PayFrequency | tinyint | No | 1 = Salary received monthly, 2 = Salary received biweekly
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_EmployeePayHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_EmployeePayHistory_PayFrequency CHECK N/A Value: ([PayFrequency] IN (1, 2) )
Check constraint [PayFrequency]=(3) OR [PayFrequency]=(2) OR [PayFrequency]=(1)
CK_EmployeePayHistory_Rate CHECK N/A Value: ([Rate] BETWEEN 6.50 AND 200.00)
Check constraint [Rate]>=(6.50) AND [Rate]<=(200.00)
PK_EmployeePayHistory_EmployeeID_RateChangeDate PRIMARY KEY EmployeeID
RateChangeDate 		Clustered index created by a primary key constraint.
FK_EmployeePayHistory_Employee_EmployeeID FOREIGN KEY EmployeeID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.EmployeeID.

Triggers

Name | Description
HumanResources.uEmployeePayHistory | AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.

Modified by

Name | Description
HumanResources.uEmployeePayHistory | AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.
HumanResources.uspUpdateEmployeeHireInfo | Updates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.

Applies to

Tables | User


HumanResources.JobCandidate

Source code
Object type: Table

Résumés submitted to Human Resources by job applicants.

Columns

Name | Data type | Nullable | Description
JobCandidateID int No Column has identity seed value of 1 with a step value of 1.
Primary key for JobCandidate records.
EmployeeID | int | Yes | Employee identification number if applicant was hired. Foreign key to Employee.EmployeeID.
Resume | XML(HumanResources.HRResumeSchemaCollection) | Yes | Résumé in XML format.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_JobCandidate_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_JobCandidate_JobCandidateID | PRIMARY KEY | JobCandidateID | Clustered index created by a primary key constraint.
FK_JobCandidate_Employee_EmployeeID FOREIGN KEY EmployeeID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.EmployeeID.

Indices

Name | Description
IX_JobCandidate_EmployeeID | Nonclustered index.

Triggers

Name | Description
HumanResources.uJobCandidate | AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.

Accessed by

Name | Description
HumanResources.vJobCandidate | Job candidate names and resumes.
HumanResources.vJobCandidateEducation | 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.
HumanResources.vJobCandidateEmployment | 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.

Modified by

Name | Description
HumanResources.uJobCandidate | AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.

Applies to

Tables | User


HumanResources.Shift

Source code
Object type: Table

Work shift lookup table.

Columns

Name | Data type | Nullable | Description
ShiftID tinyint No Column has identity seed value of 1 with a step value of 1.
Primary key for Shift records.
Name | Name | No | Shift description.
StartTime | datetime | No | Shift start time.
EndTime | datetime | No | Shift end time.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Shift_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Shift_ShiftID | PRIMARY KEY | ShiftID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Shift_Name | Unique nonclustered index.
AK_Shift_StartTime_EndTime | Unique nonclustered index.

Triggers

Name | Description
HumanResources.uShift | AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.

Linked tables

Name | Description
HumanResources.EmployeeDepartmentHistory | Employee department transfers.

Accessed by

Name | Description
HumanResources.vEmployeeDepartmentHistory | Returns employee name and current and previous departments.

Modified by

Name | Description
HumanResources.uShift | AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.

Applies to

Tables | User


Person.Address

Source code
Object type: Table

Street address information for customers, employees, and vendors.

Columns

Name | Data type | Nullable | Description
AddressID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Address records.
AddressLine1 | nvarchar(60) | No | First street address line.
AddressLine2 | nvarchar(60) | Yes | Second street address line.
City | nvarchar(30) | No | Name of the city.
StateProvinceID | int | No | Unique identification number for the state or province. Foreign key to StateProvince table.
PostalCode | nvarchar(15) | No | Postal code for the street address.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Address_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_Address_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Address_AddressID | PRIMARY KEY | AddressID | Clustered index created by a primary key constraint.
FK_Address_StateProvince_StateProvinceID FOREIGN KEY StateProvinceID Reference table: Person.StateProvince
Foreign key constraint referencing StateProvince.StateProvinceID.

Indices

Name | Description
AK_Address_rowguid | Unique nonclustered index. Used to support replication samples.
IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode | Nonclustered index.
IX_Address_StateProvinceID | Nonclustered index.

Triggers

Name | Description
Person.uAddress | AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.

Linked tables

Name | Description
HumanResources.EmployeeAddress | Cross-reference table mapping employees to their address(es).
Purchasing.VendorAddress | Cross-reference mapping vendors and addresses.
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).
Sales.SalesOrderHeader | General sales order information.

Accessed by

Name | Description
HumanResources.vEmployee | Employee names and addresses.
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Person.uAddress | AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.

Applies to

Tables | User


Person.AddressType

Source code
Object type: Table

Types of addresses stored in the Address table.

Columns

Name | Data type | Nullable | Description
AddressTypeID int No Column has identity seed value of 1 with a step value of 1.
Primary key for AddressType records.
Name | Name | No | Address type description. For example, Billing, Home, or Shipping.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_AddressType_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_AddressType_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_AddressType_AddressTypeID | PRIMARY KEY | AddressTypeID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_AddressType_Name | Unique nonclustered index.
AK_AddressType_rowguid | Unique nonclustered index. Used to support replication samples.

Triggers

Name | Description
Person.uAddressType | AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.

Linked tables

Name | Description
Purchasing.VendorAddress | Cross-reference mapping vendors and addresses.
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).

Modified by

Name | Description
Person.uAddressType | AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.

Applies to

Tables | User


Person.Contact

Source code
Object type: Table

Names of each employee, customer contact, and vendor contact.

Columns

Name | Data type | Nullable | Description
ContactID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Contact records.
NameStyle NameStyle No Default value: 0
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.
Title | nvarchar(8) | Yes | A courtesy title. For example, Mr. or Ms.
FirstName | Name | No | First name of the person.
MiddleName | Name | Yes | Middle name or middle initial of the person.
LastName | Name | No | Last name of the person.
Suffix | nvarchar(10) | Yes | Surname suffix. For example, Sr. or Jr.
EmailAddress | nvarchar(50) | Yes | E-mail address for the person.
EmailPromotion int No Default value: 0
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.
Phone | Phone | Yes | Phone number associated with the person.
PasswordHash | varchar(40) | No | Password for the e-mail account.
PasswordSalt | varchar(10) | No | Random value concatenated with the password string before the password is hashed.
AdditionalContactInfo | XML(Person.AdditionalContactInfoSchemaCollection) | Yes | Additional contact information about the person stored in xml format.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Contact_NameStyle DEFAULT NameStyle Value: 0
Default constraint value of 0
DF_Contact_EmailPromotion DEFAULT EmailPromotion Value: 0
Default constraint value of 0
DF_Contact_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_Contact_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Contact_EmailPromotion CHECK N/A Value: ([EmailPromotion] BETWEEN 0 AND 2)
Check constraint [EmailPromotion]>=(0) AND [EmailPromotion]<=(2)
PK_Contact_ContactID | PRIMARY KEY | ContactID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Contact_rowguid | Unique nonclustered index. Used to support replication samples.
IX_Contact_EmailAddress | Nonclustered index.
PXML_Contact_AddContact | Primary XML index.

Triggers

Name | Description
Person.uContact | AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.

Linked tables

Name | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.
Sales.ContactCreditCard | Cross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table.
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.
Sales.SalesOrderHeader | General sales order information.
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Accessed by

Name | Description
dbo.ufnGetContactInformation | Table value function returning the first name, last name, job title and contact type for a given contact.
dbo.uspGetEmployeeManagers | Stored procedure using a recursive query to return the direct and indirect managers of the specified employee.
dbo.uspGetManagerEmployees | Stored procedure using a recursive query to return the direct and indirect employees of the specified manager.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
HumanResources.vEmployee | Employee names and addresses.
HumanResources.vEmployeeDepartment | Returns employee name, title, and current department.
HumanResources.vEmployeeDepartmentHistory | Returns employee name and current and previous departments.
Person.vAdditionalContactInfo | Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vSalesPersonSalesByFiscalYears | Uses PIVOT to return aggregated sales information for each sales representative.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.
Territory Sales Drilldown | Adventure Works sales by territory. This report drills down through salesperson and order number with drillthrough to individual orders. This report illustrates the use of a table data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of drillthrough links and conditional formatting.

Modified by

Name | Description
Person.uContact | AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.

Applies to

Tables | User


Person.ContactType

Source code
Object type: Table

Lookup table containing the types of contacts stored in Contact.

Columns

Name | Data type | Nullable | Description
ContactTypeID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ContactType records.
Name | Name | No | Contact type description.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ContactType_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ContactType_ContactTypeID | PRIMARY KEY | ContactTypeID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_ContactType_Name | Unique nonclustered index.

Triggers

Name | Description
Person.uContactType | AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.

Linked tables

Name | Description
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Accessed by

Name | Description
dbo.ufnGetContactInformation | Table value function returning the first name, last name, job title and contact type for a given contact.
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Person.uContactType | AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.

Applies to

Tables | User


Person.CountryRegion

Source code
Object type: Table

Lookup table containing the ISO standard codes for countries and regions.

Columns

Name | Data type | Nullable | Description
CountryRegionCode | nvarchar(3) | No | ISO standard code for countries and regions.
Name | Name | No | Country or region name.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_CountryRegion_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_CountryRegion_CountryRegionCode | PRIMARY KEY | CountryRegionCode | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_CountryRegion_Name | Unique nonclustered index.

Triggers

Name | Description
Person.uCountryRegion | AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.

Linked tables

Name | Description
Person.StateProvince | State and province lookup table.
Sales.CountryRegionCurrency | Cross-reference table mapping ISO currency codes to a country or region.

Accessed by

Name | Description
HumanResources.vEmployee | Employee names and addresses.
Person.vStateProvinceCountryRegion | Joins StateProvince table with CountryRegion table.
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Person.uCountryRegion | AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.

Applies to

Tables | User


Person.StateProvince

Source code
Object type: Table

State and province lookup table.

Columns

Name | Data type | Nullable | Description
StateProvinceID int No Column has identity seed value of 1 with a step value of 1.
Primary key for StateProvince records.
StateProvinceCode | nchar(3) | No | ISO standard state or province code.
CountryRegionCode | nvarchar(3) | No | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode.
IsOnlyStateProvinceFlag Flag No Default value: 1
0 = StateProvinceCode exists. 1 = StateProvinceCode unavailable, using CountryRegionCode.
Name | Name | No | State or province description.
TerritoryID | int | No | ID of the territory in which the state or province is located. Foreign key to SalesTerritory.SalesTerritoryID.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_StateProvince_IsOnlyStateProvinceFlag DEFAULT IsOnlyStateProvinceFlag Value: 1
Default constraint value of 1 (TRUE)
DF_StateProvince_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_StateProvince_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_StateProvince_StateProvinceID | PRIMARY KEY | StateProvinceID | Clustered index created by a primary key constraint.
FK_StateProvince_CountryRegion_CountryRegionCode FOREIGN KEY CountryRegionCode Reference table: Person.CountryRegion
Foreign key constraint referencing CountryRegion.CountryRegionCode.
FK_StateProvince_SalesTerritory_TerritoryID FOREIGN KEY TerritoryID Reference table: Sales.SalesTerritory
Foreign key constraint referencing SalesTerritory.TerritoryID.

Indices

Name | Description
AK_StateProvince_Name | Unique nonclustered index.
AK_StateProvince_rowguid | Unique nonclustered index.Used to support replication samples.
AK_StateProvince_StateProvinceCode_CountryRegionCode | Unique nonclustered index.

Triggers

Name | Description
Person.uStateProvince | AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.

Linked tables

Name | Description
Person.Address | Street address information for customers, employees, and vendors.
Sales.SalesTaxRate | Tax rate lookup table.

Accessed by

Name | Description
HumanResources.vEmployee | Employee names and addresses.
Person.vStateProvinceCountryRegion | Joins StateProvince table with CountryRegion table.
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Person.uStateProvince | AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.

Applies to

Tables | User


Production.BillOfMaterials

Source code
Object type: Table

Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.

Columns

Name | Data type | Nullable | Description
BillOfMaterialsID int No Column has identity seed value of 1 with a step value of 1.
Primary key for BillOfMaterials records.
ProductAssemblyID | int | Yes | Parent product identification number. Foreign key to Product.ProductID.
ComponentID | int | No | Component identification number. Foreign key to Product.ProductID.
StartDate datetime No Default value: GETDATE()
Date the component started being used in the assembly item.
EndDate | datetime | Yes | Date the component stopped being used in the assembly item.
UnitMeasureCode | nchar(3) | No | Standard code identifying the unit of measure for the quantity.
BOMLevel | smallint | No | Indicates the depth the component is from its parent (AssemblyID).
PerAssemblyQty decimal(8, 2) No Default value: 1.00
Quantity of the component needed to create the assembly.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_BillOfMaterials_StartDate DEFAULT StartDate Value: GETDATE()
Default constraint value of GETDATE()
DF_BillOfMaterials_PerAssemblyQty DEFAULT PerAssemblyQty Value: 1.00
Default constraint value of 1.0
DF_BillOfMaterials_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_BillOfMaterials_EndDate CHECK N/A Value: (([EndDate] > [StartDate]) OR ([EndDate] IS NULL) )
Check constraint EndDate]>[StartDate] OR [EndDate] IS NULL
CK_BillOfMaterials_ProductAssemblyID CHECK N/A Value: ([ProductAssemblyID] <> [ComponentID])
Check constraint [ProductAssemblyID]<>[ComponentID]
CK_BillOfMaterials_BOMLevel CHECK N/A Value: ((([ProductAssemblyID] IS NULL) AND ([BOMLevel] = 0) AND ([PerAssemblyQty] = 1.00) ) OR (([ProductAssemblyID] IS NOT NULL) AND ([BOMLevel] >= 1) ) )
Check constraint [ProductAssemblyID] IS NULL AND [BOMLevel] = (0) AND [PerAssemblyQty] = (1) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel] >= (1)
CK_BillOfMaterials_PerAssemblyQty CHECK N/A Value: ([PerAssemblyQty] >= 1.00)
Check constraint [PerAssemblyQty]>=(1.00)
PK_BillOfMaterials_BillOfMaterialsID | PRIMARY KEY | BillOfMaterialsID | Nonclustered index created by a primary key constraint.
FK_BillOfMaterials_Product_ProductAssemblyID FOREIGN KEY ProductAssemblyID Reference table: Production.Product
Foreign key constraint referencing Product.ProductAssemblyID.
FK_BillOfMaterials_Product_ComponentID FOREIGN KEY ComponentID Reference table: Production.Product
Foreign key constraint referencing Product.ComponentID.
FK_BillOfMaterials_UnitMeasure_UnitMeasureCode FOREIGN KEY UnitMeasureCode Reference table: Production.UnitMeasure
Foreign key constraint referencing UnitMeasure.UnitMeasureCode.

Indices

Name | Description
AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate | Clustered index.
IX_BillOfMaterials_UnitMeasureCode | Nonclustered index.

Triggers

Name | Description
Production.uBillOfMaterials | AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.

Accessed by

Name | Description
dbo.uspGetBillOfMaterials | Stored procedure using a recursive query to return a multi-level bill of material for the specified ProductID.
dbo.uspGetWhereUsedProductID | Stored procedure using a recursive query to return all components or assemblies that directly or indirectly use the specified ProductID.

Modified by

Name | Description
Production.uBillOfMaterials | AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.

Applies to

Tables | User


Production.Culture

Source code
Object type: Table

Lookup table containing the languages in which some AdventureWorks data is stored.

Columns

Name | Data type | Nullable | Description
CultureID | nchar(6) | No | Primary key for Culture records.
Name | Name | No | Culture description.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Culture_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Culture_CultureID | PRIMARY KEY | CultureID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Culture_Name | Unique nonclustered index.

Triggers

Name | Description
Production.uCulture | AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.

Linked tables

Name | Description
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.

Modified by

Name | Description
Production.uCulture | AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.

Applies to

Tables | User


Production.Document

Source code
Object type: Table

Product maintenance documents.

Columns

Name | Data type | Nullable | Description
DocumentID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Document records.
Title | nvarchar(50) | No | Title of the document.
FileName | nvarchar(400) | No | Directory path and file name of the document
FileExtension | nvarchar(8) | No | File extension indicating the document type. For example, .doc or .txt.
Revision | nchar(5) | No | Revision number of the document.
ChangeNumber int No Default value: 0
Engineering change approval number.
Status | tinyint | No | 1 = Pending approval, 2 = Approved, 3 = Obsolete
DocumentSummary | nvarchar(max) | Yes | Document abstract.
Document | varbinary(max) | Yes | Complete document.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Document_ChangeNumber DEFAULT ChangeNumber Value: 0
Default constraint value of 0
DF_Document_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Document_Status CHECK N/A Value: ([Status] BETWEEN 1 AND 3)
Check constraint [Status] BETWEEN (1) AND (3)
PK_Document_DocumentID | PRIMARY KEY | DocumentID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Document_FileName_Revision | Unique nonclustered index.

Triggers

Name | Description
Production.uDocument | AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.

Linked tables

Name | Description
Production.ProductDocument | Cross-reference table mapping products to related product documents.

Modified by

Name | Description
Production.uDocument | AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.

Applies to

Tables | User


Production.Illustration

Source code
Object type: Table

Bicycle assembly diagrams.

Columns

Name | Data type | Nullable | Description
IllustrationID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Illustration records.
Diagram | XML | Yes | Illustrations used in manufacturing instructions. Stored as XML.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Illustration_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Illustration_IllustrationID | PRIMARY KEY | IllustrationID | Clustered index created by a primary key constraint.

Triggers

Name | Description
Production.uIllustration | AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.

Linked tables

Name | Description
Production.ProductModelIllustration | Cross-reference table mapping product models and illustrations.

Modified by

Name | Description
Production.uIllustration | AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.

Applies to

Tables | User


Production.Location

Source code
Object type: Table

Product inventory and manufacturing locations.

Columns

Name | Data type | Nullable | Description
LocationID smallint No Column has identity seed value of 1 with a step value of 1.
Primary key for Location records.
Name | Name | No | Location description.
CostRate smallmoney No Default value: 0.00
Standard hourly cost of the manufacturing location.
Availability decimal(8, 2) No Default value: 0.00
Work capacity (in hours) of the manufacturing location.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Location_CostRate DEFAULT CostRate Value: 0.00
Default constraint value of 0.0
DF_Location_Availability DEFAULT Availability Value: 0.00
Default constraint value of 0.00
DF_Location_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Location_CostRate CHECK N/A Value: ([CostRate] >= 0.00)
Check constraint [CostRate]>=(0.00)
CK_Location_Availability CHECK N/A Value: ([Availability] >= 0.00)
Check constraint [Availability]>=(0.00)
PK_Location_LocationID | PRIMARY KEY | LocationID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Location_Name | Unique nonclustered index.

Triggers

Name | Description
Production.uLocation | AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.

Linked tables

Name | Description
Production.ProductInventory | Product inventory information.
Production.WorkOrderRouting | Work order details.

Modified by

Name | Description
Production.uLocation | AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.

Applies to

Tables | User


Production.Product

Source code
Object type: Table

Products sold or used in the manfacturing of sold products.

Columns

Name | Data type | Nullable | Description
ProductID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Product records.
Name | Name | No | Name of the product.
ProductNumber | nvarchar(25) | No | Unique product identification number.
MakeFlag Flag No Default value: 1
0 = Product is purchased, 1 = Product is manufactured in-house.
FinishedGoodsFlag Flag No Default value: 1
0 = Product is not a salable item. 1 = Product is salable.
Color | nvarchar(15) | Yes | Product color.
SafetyStockLevel | smallint | No | Minimum inventory quantity.
ReorderPoint | smallint | No | Inventory level that triggers a purchase order or work order.
StandardCost | money | No | Standard cost of the product.
ListPrice | money | No | Selling price.
Size | nvarchar(5) | Yes | Product size.
SizeUnitMeasureCode | nchar(3) | Yes | Unit of measure for Size column.
WeightUnitMeasureCode | nchar(3) | Yes | Unit of measure for Weight column.
Weight | decimal(8, 2) | Yes | Product weight.
DaysToManufacture | int | No | Number of days required to manufacture the product.
ProductLine | nchar(2) | Yes | R = Road, M = Mountain, T = Touring, S = Standard
Class | nchar(2) | Yes | H = High, M = Medium, L = Low
Style | nchar(2) | Yes | W = Womens, M = Mens, U = Universal
ProductSubcategoryID | int | Yes | Product is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID.
ProductModelID | int | Yes | Product is a member of this product model. Foreign key to ProductModel.ProductModelID.
SellStartDate | datetime | No | Date the product was available for sale.
SellEndDate | datetime | Yes | Date the product was no longer available for sale.
DiscontinuedDate | datetime | Yes | Date the product was discontinued.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Product_MakeFlag DEFAULT MakeFlag Value: 1
Default constraint value of 1
DF_Product_FinishedGoodsFlag DEFAULT FinishedGoodsFlag Value: 1
Default constraint value of 1
DF_Product_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_Product_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Product_SafetyStockLevel CHECK N/A Value: ([SafetyStockLevel] > 0)
Check constraint [SafetyStockLevel]>(0)
CK_Product_ReorderPoint CHECK N/A Value: ([ReorderPoint] > 0)
Check constraint [ReorderPoint]>(0)
CK_Product_StandardCost CHECK N/A Value: ([StandardCost] >= 0.00)
Check constraint [SafetyStockLevel]>(0)
CK_Product_ListPrice CHECK N/A Value: ([ListPrice] >= 0.00)
Check constraint [ListPrice]>=(0.00)
CK_Product_Weight CHECK N/A Value: ([Weight] > 0.00)
Check constraint [Weight]>(0.00)
CK_Product_DaysToManufacture CHECK N/A Value: ([DaysToManufacture] >= 0)
Check constraint [DaysToManufacture]>=(0)
CK_Product_ProductLine CHECK N/A Value: (UPPER([ProductLine]) IN ('S', 'T', 'M', 'R') OR [ProductLine] IS NULL)
Check constraint [ProductLine]='r' OR [ProductLine]='m' OR [ProductLine]='t' OR [ProductLine]='s' OR [ProductLine]='R' OR [ProductLine]='M' OR [ProductLine]='T' OR [ProductLine]='S' OR [ProductLine] IS NULL
CK_Product_Class CHECK N/A Value: (UPPER([Class]) IN ('L', 'M', 'H') OR [Class] IS NULL)
Check constraint [Class]='h' OR [Class]='m' OR [Class]='l' OR [Class]='H' OR [Class]='M' OR [Class]='L' OR [Class] IS NULL
CK_Product_Style CHECK N/A Value: (UPPER([Style]) IN ('W', 'M', 'U') OR [Style] IS NULL)
Check constraint [Style]='u' OR [Style]='m' OR [Style]='w' OR [Style]='U' OR [Style]='M' OR [Style]='W' OR [Style] IS NULL
CK_Product_SellEndDate CHECK N/A Value: (([SellEndDate] >= [SellStartDate]) OR ([SellEndDate] IS NULL) )
Check constraint [SellEndDate] >= [SellStartDate] OR [SellEndDate] IS NULL
PK_Product_ProductID | PRIMARY KEY | ProductID | Clustered index created by a primary key constraint.
FK_Product_UnitMeasure_SizeUnitMeasureCode FOREIGN KEY SizeUnitMeasureCode Reference table: Production.UnitMeasure
Foreign key constraint referencing UnitMeasure.UnitMeasureCode.
FK_Product_UnitMeasure_WeightUnitMeasureCode FOREIGN KEY WeightUnitMeasureCode Reference table: Production.UnitMeasure
Foreign key constraint referencing UnitMeasure.UnitMeasureCode.
FK_Product_ProductModel_ProductModelID FOREIGN KEY ProductModelID Reference table: Production.ProductModel
Foreign key constraint referencing ProductModel.ProductModelID.
FK_Product_ProductSubcategory_ProductSubcategoryID FOREIGN KEY ProductSubcategoryID Reference table: Production.ProductSubcategory
Foreign key constraint referencing ProductSubcategory.ProductSubcategoryID.

Indices

Name | Description
AK_Product_Name | Unique nonclustered index.
AK_Product_ProductNumber | Unique nonclustered index.
AK_Product_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Production.uProduct | AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.

Linked tables

Name | Description
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.ProductCostHistory | Changes in the cost of a product over time.
Production.ProductDocument | Cross-reference table mapping products to related product documents.
Production.ProductInventory | Product inventory information.
Production.ProductListPriceHistory | Changes in the list price of a product over time.
Production.ProductProductPhoto | Cross-reference table mapping products and product photos.
Production.ProductReview | Customer reviews of products they have purchased.
Production.TransactionHistory | Record of each purchase order, sales order, or work order transaction year to date.
Production.WorkOrder | Manufacturing work orders.
Purchasing.ProductVendor | Cross-reference table mapping vendors with the products they supply.
Purchasing.PurchaseOrderDetail | Individual products associated with a specific purchase order. See PurchaseOrderHeader.
Sales.ShoppingCartItem | Contains online customer orders until the order is submitted or cancelled.
Sales.SpecialOfferProduct | Cross-reference table mapping products to special offer discounts.

Accessed by

Name | Description
Company Sales | Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images.
dbo.ufnGetProductDealerPrice | Scalar function returning the dealer price for a given product on a particular order date.
dbo.ufnGetProductListPrice | Scalar function returning the list price for a given product on a particular order date.
dbo.ufnGetProductStandardCost | Scalar function returning the standard cost for a given product on a particular order date.
dbo.uspGetBillOfMaterials | Stored procedure using a recursive query to return a multi-level bill of material for the specified ProductID.
dbo.uspGetWhereUsedProductID | Stored procedure using a recursive query to return all components or assemblies that directly or indirectly use the specified ProductID.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Production.vProductAndDescription | Product names and descriptions. Product descriptions are provided in multiple languages.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.

Modified by

Name | Description
Production.uProduct | AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.

Applies to

Tables | User


Production.ProductCategory

Source code
Object type: Table

High-level product categorization.

Columns

Name | Data type | Nullable | Description
ProductCategoryID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ProductCategory records.
Name | Name | No | Category description.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ProductCategory_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()()
DF_ProductCategory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductCategory_ProductCategoryID | PRIMARY KEY | ProductCategoryID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_ProductCategory_Name | Unique nonclustered index.
AK_ProductCategory_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Production.uProductCategory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.

Linked tables

Name | Description
Production.ProductSubcategory | Product subcategories. See ProductCategory table.

Accessed by

Name | Description
Company Sales | Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.

Modified by

Name | Description
Production.uProductCategory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.

Applies to

Tables | User


Production.ProductCostHistory

Source code
Object type: Table

Changes in the cost of a product over time.

Columns

Name | Data type | Nullable | Description
ProductID | int | No | Product identification number. Foreign key to Product.ProductID
StartDate | datetime | No | Product cost start date.
EndDate | datetime | Yes | Product cost end date.
StandardCost | money | No | Standard cost of the product.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductCostHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ProductCostHistory_EndDate CHECK N/A Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL
CK_ProductCostHistory_StandardCost CHECK N/A Value: ([StandardCost] >= 0.00)
Check constraint [StandardCost]>=(0.00)
PK_ProductCostHistory_ProductID_StartDate PRIMARY KEY ProductID
StartDate 		Clustered index created by a primary key constraint.
FK_ProductCostHistory_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.

Triggers

Name | Description
Production.uProductCostHistory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.

Accessed by

Name | Description
dbo.ufnGetProductStandardCost | Scalar function returning the standard cost for a given product on a particular order date.

Modified by

Name | Description
Production.uProductCostHistory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.

Applies to

Tables | User


Production.ProductDescription

Source code
Object type: Table

Product descriptions in several languages.

Columns

Name | Data type | Nullable | Description
ProductDescriptionID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ProductDescription records.
Description | nvarchar(400) | No | Description of the product.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ProductDescription_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_ProductDescription_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductDescription_ProductDescriptionID | PRIMARY KEY | ProductDescriptionID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_ProductDescription_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Production.uProductDescription | AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.

Linked tables

Name | Description
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.

Accessed by

Name | Description
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.
Production.vProductAndDescription | Product names and descriptions. Product descriptions are provided in multiple languages.

Modified by

Name | Description
Production.uProductDescription | AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.

Applies to

Tables | User


Production.ProductDocument

Source code
Object type: Table

Cross-reference table mapping products to related product documents.

Columns

Name | Data type | Nullable | Description
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
DocumentID | int | No | Document identification number. Foreign key to Document.DocumentID.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductDocument_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductDocument_ProductID_DocumentID PRIMARY KEY ProductID
DocumentID 		Clustered index created by a primary key constraint.
FK_ProductDocument_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
FK_ProductDocument_Document_DocumentID FOREIGN KEY DocumentID Reference table: Production.Document
Foreign key constraint referencing Document.DocumentID.

Triggers

Name | Description
Production.uProductDocument | AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.

Modified by

Name | Description
Production.uProductDocument | AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.

Applies to

Tables | User


Production.ProductInventory

Source code
Object type: Table

Product inventory information.

Columns

Name | Data type | Nullable | Description
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
LocationID | smallint | No | Inventory location identification number. Foreign key to Location.LocationID.
Shelf | nvarchar(10) | No | Storage compartment within an inventory location.
Bin | tinyint | No | Storage container on a shelf in an inventory location.
Quantity smallint No Default value: 0
Quantity of products in the inventory location.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductInventory_Quantity DEFAULT Quantity Value: 0
Default constraint value of 0
DF_ProductInventory_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_ProductInventory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ProductInventory_Shelf CHECK N/A Value: (([Shelf] LIKE '[A-Za-z]') OR ([Shelf] = 'N/A') )
Check constraint [Shelf] like '[A-Za-z]' OR [Shelf]='N/A'
CK_ProductInventory_Bin CHECK N/A Value: ([Bin] BETWEEN 0 AND 100)
Check constraint [Bin] BETWEEN (0) AND (100)
PK_ProductInventory_ProductID_LocationID PRIMARY KEY ProductID
LocationID 		Clustered index created by a primary key constraint.
FK_ProductInventory_Location_LocationID FOREIGN KEY LocationID Reference table: Production.Location
Foreign key constraint referencing Location.LocationID.
FK_ProductInventory_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.

Indices

Name | Description
AK_ProductInventory_rowguid | Unique nonclustered index.Used to support replication samples.
IX_ProductInventory_ProductID | Nonclustered index.

Triggers

Name | Description
Production.uProductInventory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.

Accessed by

Name | Description
dbo.ufnGetStock | Scalar function returning the quantity of inventory in LocationID 6 (Miscellaneous Storage)for a specified ProductID.

Modified by

Name | Description
Production.uProductInventory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.

Applies to

Tables | User


Production.ProductListPriceHistory

Source code
Object type: Table

Changes in the list price of a product over time.

Columns

Name | Data type | Nullable | Description
ProductID | int | No | Product identification number. Foreign key to Product.ProductID
StartDate | datetime | No | List price start date.
EndDate | datetime | Yes | List price end date
ListPrice | money | No | Product list price.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductListPriceHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ProductListPriceHistory_EndDate CHECK N/A Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL
CK_ProductListPriceHistory_ListPrice CHECK N/A Value: ([ListPrice] > 0.00)
Check constraint [ListPrice]>(0.00)
PK_ProductListPriceHistory_ProductID_StartDate PRIMARY KEY ProductID
StartDate 		Clustered index created by a primary key constraint.
FK_ProductListPriceHistory_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.

Triggers

Name | Description
Production.uProductListPriceHistory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.

Accessed by

Name | Description
dbo.ufnGetProductDealerPrice | Scalar function returning the dealer price for a given product on a particular order date.
dbo.ufnGetProductListPrice | Scalar function returning the list price for a given product on a particular order date.

Modified by

Name | Description
Production.uProductListPriceHistory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.

Applies to

Tables | User


Production.ProductModel

Source code
Object type: Table

Product model classification.

Columns

Name | Data type | Nullable | Description
ProductModelID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ProductModel records.
Name | Name | No | Product model description.
CatalogDescription | XML(Production.ProductDescriptionSchemaCollection) | Yes | Detailed product catalog information in xml format.
Instructions | XML(Production.ManuInstructionsSchemaCollection) | Yes | Manufacturing instructions in xml format.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ProductModel_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_ProductModel_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductModel_ProductModelID | PRIMARY KEY | ProductModelID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_ProductModel_Name | Unique nonclustered index.
AK_ProductModel_rowguid | Unique nonclustered index.Used to support replication samples.
PXML_ProductModel_CatalogDescription | Primary XML index.
PXML_ProductModel_Instructions | Primary XML index.

Triggers

Name | Description
Production.uProductModel | AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.

Linked tables

Name | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductModelIllustration | Cross-reference table mapping product models and illustrations.
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.

Accessed by

Name | Description
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.
Production.vProductAndDescription | Product names and descriptions. Product descriptions are provided in multiple languages.
Production.vProductModelCatalogDescription | Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.
Production.vProductModelInstructions | Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.

Modified by

Name | Description
Production.uProductModel | AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.

Applies to

Tables | User


Production.ProductModelIllustration

Source code
Object type: Table

Cross-reference table mapping product models and illustrations.

Columns

Name | Data type | Nullable | Description
ProductModelID | int | No | Primary key. Foreign key to ProductModel.ProductModelID.
IllustrationID | int | No | Primary key. Foreign key to Illustration.IllustrationID.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductModelIllustration_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductModelIllustration_ProductModelID_IllustrationID PRIMARY KEY ProductModelID
IllustrationID 		Clustered index created by a primary key constraint.
FK_ProductModelIllustration_ProductModel_ProductModelID FOREIGN KEY ProductModelID Reference table: Production.ProductModel
Foreign key constraint referencing ProductModel.ProductModelID.
FK_ProductModelIllustration_Illustration_IllustrationID FOREIGN KEY IllustrationID Reference table: Production.Illustration
Foreign key constraint referencing Illustration.IllustrationID.

Triggers

Name | Description
Production.uProductModelIllustration | AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.

Modified by

Name | Description
Production.uProductModelIllustration | AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.

Applies to

Tables | User


Production.ProductModelProductDescriptionCulture

Source code
Object type: Table

Cross-reference table mapping product descriptions and the language the description is written in.

Columns

Name | Data type | Nullable | Description
ProductModelID | int | No | Primary key. Foreign key to ProductModel.ProductModelID.
ProductDescriptionID | int | No | Primary key. Foreign key to ProductDescription.ProductDescriptionID.
CultureID | nchar(6) | No | Culture identification number. Foreign key to Culture.CultureID.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductModelProductDescriptionCulture_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID PRIMARY KEY ProductModelID
ProductDescriptionID
CultureID 		Clustered index created by a primary key constraint.
FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID FOREIGN KEY ProductDescriptionID Reference table: Production.ProductDescription
Foreign key constraint referencing ProductDescription.ProductDescriptionID.
FK_ProductModelProductDescriptionCulture_Culture_CultureID FOREIGN KEY CultureID Reference table: Production.Culture
Foreign key constraint referencing Culture.CultureID.
FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID FOREIGN KEY ProductModelID Reference table: Production.ProductModel
Foreign key constraint referencing ProductModel.ProductModelID.

Triggers

Name | Description
Production.uProductModelProductDescriptionCulture | AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.

Accessed by

Name | Description
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.
Production.vProductAndDescription | Product names and descriptions. Product descriptions are provided in multiple languages.

Modified by

Name | Description
Production.uProductModelProductDescriptionCulture | AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.

Applies to

Tables | User


Production.ProductPhoto

Source code
Object type: Table

Product images.

Columns

Name | Data type | Nullable | Description
ProductPhotoID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ProductPhoto records.
ThumbNailPhoto | varbinary(max) | Yes | Small image of the product.
ThumbnailPhotoFileName | nvarchar(50) | Yes | Small image file name.
LargePhoto | varbinary(max) | Yes | Large image of the product.
LargePhotoFileName | nvarchar(50) | Yes | Large image file name.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ProductPhoto_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductPhoto_ProductPhotoID | PRIMARY KEY | ProductPhotoID | Clustered index created by a primary key constraint.

Triggers

Name | Description
Production.uProductPhoto | AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.

Linked tables

Name | Description
Production.ProductProductPhoto | Cross-reference table mapping products and product photos.

Accessed by

Name | Description
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.

Modified by

Name | Description
Production.uProductPhoto | AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.

Applies to

Tables | User


Production.ProductProductPhoto

Source code
Object type: Table

Cross-reference table mapping products and product photos.

Columns

Name | Data type | Nullable | Description
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
ProductPhotoID | int | No | Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.
Primary Flag No Default value: 0
0 = Photo is not the principal image. 1 = Photo is the principal image.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductProductPhoto_Primary DEFAULT Primary Value: 0
Default constraint value of 0 (FALSE)
DF_ProductProductPhoto_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductProductPhoto_ProductID_ProductPhotoID PRIMARY KEY ProductID
ProductPhotoID 		Nonclustered index created by a primary key constraint.
FK_ProductProductPhoto_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
FK_ProductProductPhoto_ProductPhoto_ProductPhotoID FOREIGN KEY ProductPhotoID Reference table: Production.ProductPhoto
Foreign key constraint referencing ProductPhoto.ProductPhotoID.

Indices

Name | Description
AK_ProductProductPhoto_ProductID_ProductPhotoID | Unique nonclustered index.

Triggers

Name | Description
Production.uProductProductPhoto | AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.

Accessed by

Name | Description
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.

Modified by

Name | Description
Production.uProductProductPhoto | AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.

Applies to

Tables | User


Production.ProductReview

Source code
Object type: Table

Customer reviews of products they have purchased.

Columns

Name | Data type | Nullable | Description
ProductReviewID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ProductReview records.
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
ReviewerName | Name | No | Name of the reviewer.
ReviewDate datetime No Default value: GETDATE()
Date review was submitted.
EmailAddress | nvarchar(50) | No | Reviewer's e-mail address.
Rating | int | No | Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating.
Comments | nvarchar(3850) | Yes | Reviewer's comments
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ProductReview_ReviewDate DEFAULT ReviewDate Value: GETDATE()
Default constraint value of GETDATE()
DF_ProductReview_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ProductReview_Rating CHECK N/A Value: ([Rating] BETWEEN 1 AND 5)
Check constraint [Rating] BETWEEN (1) AND (5)
PK_ProductReview_ProductReviewID | PRIMARY KEY | ProductReviewID | Clustered index created by a primary key constraint.
FK_ProductReview_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.

Indices

Name | Description
IX_ProductReview_ProductID_Name | Nonclustered index.

Triggers

Name | Description
Production.uProductReview | AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.

Modified by

Name | Description
Production.uProductReview | AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.

Applies to

Tables | User


Production.ProductSubcategory

Source code
Object type: Table

Product subcategories. See ProductCategory table.

Columns

Name | Data type | Nullable | Description
ProductSubcategoryID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ProductSubcategory records.
ProductCategoryID | int | No | Product category identification number. Foreign key to ProductCategory.ProductCategoryID.
Name | Name | No | Subcategory description.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ProductSubcategory_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_ProductSubcategory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ProductSubcategory_ProductSubcategoryID | PRIMARY KEY | ProductSubcategoryID | Clustered index created by a primary key constraint.
FK_ProductSubcategory_ProductCategory_ProductCategoryID FOREIGN KEY ProductCategoryID Reference table: Production.ProductCategory
Foreign key constraint referencing ProductCategory.ProductCategoryID.

Indices

Name | Description
AK_ProductSubcategory_Name | Unique nonclustered index.
AK_ProductSubcategory_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Production.uProductSubcategory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.

Linked tables

Name | Description
Production.Product | Products sold or used in the manfacturing of sold products.

Accessed by

Name | Description
Company Sales | Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
Product Catalog | Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.

Modified by

Name | Description
Production.uProductSubcategory | AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.

Applies to

Tables | User


Production.ScrapReason

Source code
Object type: Table

Manufacturing failure reasons lookup table.

Columns

Name | Data type | Nullable | Description
ScrapReasonID smallint No Column has identity seed value of 1 with a step value of 1.
Primary key for ScrapReason records.
Name | Name | No | Failure description.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ScrapReason_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ScrapReason_ScrapReasonID | PRIMARY KEY | ScrapReasonID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_ScrapReason_Name | Unique nonclustered index.

Triggers

Name | Description
Production.uScrapReason | AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.

Linked tables

Name | Description
Production.WorkOrder | Manufacturing work orders.

Modified by

Name | Description
Production.uScrapReason | AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.

Applies to

Tables | User


Production.TransactionHistory

Source code
Object type: Table

Record of each purchase order, sales order, or work order transaction year to date.

Columns

Name | Data type | Nullable | Description
TransactionID int No Column has identity seed value of 1 with a step value of 1.
Primary key for TransactionHistory records.
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
ReferenceOrderID | int | No | Purchase order, sales order, or work order identification number.
ReferenceOrderLineID int No Default value: 0
Line number associated with the purchase order, sales order, or work order.
TransactionDate datetime No Default value: GETDATE()
Date and time of the transaction.
TransactionType | nchar(1) | No | W = WorkOrder, S = SalesOrder, P = PurchaseOrder
Quantity | int | No | Product quantity.
ActualCost | money | No | Product cost.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_TransactionHistory_ReferenceOrderLineID DEFAULT ReferenceOrderLineID Value: 0
Default constraint value of 0
DF_TransactionHistory_TransactionDate DEFAULT TransactionDate Value: GETDATE()
Default constraint value of GETDATE()
DF_TransactionHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_TransactionHistory_TransactionType CHECK N/A Value: (UPPER([TransactionType]) IN ('W', 'S', 'P') )
Check constraint [TransactionType]='p' OR [TransactionType]='s' OR [TransactionType]='w' OR [TransactionType]='P' OR [TransactionType]='S' OR [TransactionType]='W')
PK_TransactionHistory_TransactionID | PRIMARY KEY | TransactionID | Clustered index created by a primary key constraint.
FK_TransactionHistory_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.

Indices

Name | Description
IX_TransactionHistory_ProductID | Nonclustered index.
IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID | Nonclustered index.>

Triggers

Name | Description
Production.uTransactionHistory | AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.

Modified by

Name | Description
Production.iWorkOrder | AFTER INSERT trigger that inserts a row in the TransactionHistory table.
Production.uTransactionHistory | AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.
Production.uWorkOrder | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.
Purchasing.iPurchaseOrderDetail | AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.
Purchasing.uPurchaseOrderDetail | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.
Sales.iduSalesOrderDetail | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.

Applies to

Tables | User


Production.TransactionHistoryArchive

Source code
Object type: Table

Transactions for previous years.

Columns

Name | Data type | Nullable | Description
TransactionID | int | No | Primary key for TransactionHistoryArchive records.
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
ReferenceOrderID | int | No | Purchase order, sales order, or work order identification number.
ReferenceOrderLineID int No Default value: 0
Line number associated with the purchase order, sales order, or work order.
TransactionDate datetime No Default value: GETDATE()
Date and time of the transaction.
TransactionType | nchar(1) | No | W = Work Order, S = Sales Order, P = Purchase Order
Quantity | int | No | Product quantity.
ActualCost | money | No | Product cost.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_TransactionHistoryArchive_ReferenceOrderLineID DEFAULT ReferenceOrderLineID Value: 0
Default constraint value of 0
DF_TransactionHistoryArchive_TransactionDate DEFAULT TransactionDate Value: GETDATE()
Default constraint value of GETDATE()
DF_TransactionHistoryArchive_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_TransactionHistoryArchive_TransactionType CHECK N/A Value: (UPPER([TransactionType]) IN ('W', 'S', 'P') )
Check constraint [TransactionType]='p' OR [TransactionType]='s' OR [TransactionType]='w' OR [TransactionType]='P' OR [TransactionType]='S' OR [TransactionType]='W'
PK_TransactionHistoryArchive_TransactionID | PRIMARY KEY | TransactionID | Clustered index created by a primary key constraint.

Indices

Name | Description
IX_TransactionHistoryArchive_ProductID | Nonclustered index.
IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID | Nonclustered index.

Triggers

Name | Description
Production.uTransactionHistoryArchive | AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.

Modified by

Name | Description
Production.uTransactionHistoryArchive | AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.

Applies to

Tables | User


Production.UnitMeasure

Source code
Object type: Table

Unit of measure lookup table.

Columns

Name | Data type | Nullable | Description
UnitMeasureCode | nchar(3) | No | Primary key.
Name | Name | No | Unit of measure description.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_UnitMeasure_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_UnitMeasure_UnitMeasureCode | PRIMARY KEY | UnitMeasureCode | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_UnitMeasure_Name | Unique nonclustered index.

Triggers

Name | Description
Production.uUnitMeasure | AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.

Linked tables

Name | Description
Production.BillOfMaterials | Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
Production.Product | Products sold or used in the manfacturing of sold products.
Purchasing.ProductVendor | Cross-reference table mapping vendors with the products they supply.

Modified by

Name | Description
Production.uUnitMeasure | AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.

Applies to

Tables | User


Production.WorkOrder

Source code
Object type: Table

Manufacturing work orders.

Columns

Name | Data type | Nullable | Description
WorkOrderID int No Column has identity seed value of 1 with a step value of 1.
Primary key for WorkOrder records.
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
OrderQty | int | No | Product quantity to build.
StockedQty | ISNULL([OrderQty] - [ScrappedQty], 0) | Yes | Quantity built and put in inventory.
ScrappedQty | smallint | No | Quantity that failed inspection.
StartDate | datetime | No | Work order start date.
EndDate | datetime | Yes | Work order end date.
DueDate | datetime | No | Work order due date.
ScrapReasonID | smallint | Yes | Reason for inspection failure.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_WorkOrder_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_WorkOrder_OrderQty CHECK N/A Value: ([OrderQty] > 0)
Check constraint [OrderQty]>(0)
CK_WorkOrder_ScrappedQty CHECK N/A Value: ([ScrappedQty] >= 0)
Check constraint [ScrappedQty]>=(0)
CK_WorkOrder_EndDate CHECK N/A Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL
PK_WorkOrder_WorkOrderID | PRIMARY KEY | WorkOrderID | Clustered index created by a primary key constraint.
FK_WorkOrder_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
FK_WorkOrder_ScrapReason_ScrapReasonID FOREIGN KEY ScrapReasonID Reference table: Production.ScrapReason
Foreign key constraint referencing ScrapReason.ScrapReasonID.

Indices

Name | Description
IX_WorkOrder_ProductID | Nonclustered index.
IX_WorkOrder_ScrapReasonID | Nonclustered index.

Triggers

Name | Description
Production.iWorkOrder | AFTER INSERT trigger that inserts a row in the TransactionHistory table.
Production.uWorkOrder | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.

Linked tables

Name | Description
Production.WorkOrderRouting | Work order details.

Modified by

Name | Description
Production.uWorkOrder | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.

Applies to

Tables | User


Production.WorkOrderRouting

Source code
Object type: Table

Work order details.

Columns

Name | Data type | Nullable | Description
WorkOrderID | int | No | Primary key. Foreign key to WorkOrder.WorkOrderID.
ProductID | int | No | Primary key. Foreign key to Product.ProductID.
OperationSequence | smallint | No | Primary key. Indicates the manufacturing process sequence.
LocationID | smallint | No | Manufacturing location where the part is processed. Foreign key to Location.LocationID.
ScheduledStartDate | datetime | No | Planned manufacturing start date.
ScheduledEndDate | datetime | No | Planned manufacturing end date.
ActualStartDate | datetime | Yes | Actual start date.
ActualEndDate | datetime | Yes | Actual end date.
ActualResourceHrs | decimal(9, 4) | Yes | Number of manufacturing hours used.>
PlannedCost | money | No | Estimated manufacturing cost.
ActualCost | money | Yes | Actual manufacturing cost.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_WorkOrderRouting_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_WorkOrderRouting_ScheduledEndDate CHECK N/A Value: ([ScheduledEndDate] >= [ScheduledStartDate])
Check constraint [ScheduledEndDate] >= [ScheduledStartDate]
CK_WorkOrderRouting_ActualEndDate CHECK N/A Value: (([ActualEndDate] >= [ActualStartDate]) OR ([ActualEndDate] IS NULL) OR ([ActualStartDate] IS NULL) )
Check constraint [ActualEndDate] >= [ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL
CK_WorkOrderRouting_ActualResourceHrs CHECK N/A Value: ([ActualResourceHrs] >= 0.0000)
Check constraint [ActualResourceHrs]>=(0.0000)
CK_WorkOrderRouting_PlannedCost CHECK N/A Value: ([PlannedCost] > 0.00)
Check constraint [PlannedCost]>(0.00)
CK_WorkOrderRouting_ActualCost CHECK N/A Value: ([ActualCost] > 0.00)
Check constraint [ActualCost]>(0.00)
PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence PRIMARY KEY WorkOrderID
ProductID
OperationSequence 		Clustered index created by a primary key constraint.
FK_WorkOrderRouting_Location_LocationID FOREIGN KEY LocationID Reference table: Production.Location
Foreign key constraint referencing Location.LocationID.
FK_WorkOrderRouting_WorkOrder_WorkOrderID FOREIGN KEY WorkOrderID Reference table: Production.WorkOrder
Foreign key constraint referencing WorkOrder.WorkOrderID.

Indices

Name | Description
IX_WorkOrderRouting_ProductID | Nonclustered index.

Triggers

Name | Description
Production.uWorkOrderRouting | AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.

Modified by

Name | Description
Production.uWorkOrderRouting | AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.

Applies to

Tables | User


Purchasing.ProductVendor

Source code
Object type: Table

Cross-reference table mapping vendors with the products they supply.

Columns

Name | Data type | Nullable | Description
ProductID | int | No | Primary key. Foreign key to Product.ProductID.
VendorID | int | No | Primary key. Foreign key to Vendor.VendorID.
AverageLeadTime | int | No | The average span of time (in days) between placing an order with the vendor and receiving the purchased product.
StandardPrice | money | No | The vendor's usual selling price.
LastReceiptCost | money | Yes | The selling price when last purchased.
LastReceiptDate | datetime | Yes | Date the product was last received by the vendor.
MinOrderQty | int | No | The maximum quantity that should be ordered.
MaxOrderQty | int | No | The minimum quantity that should be ordered.
OnOrderQty | int | Yes | The quantity currently on order.
UnitMeasureCode | nchar(3) | No | The product's unit of measure.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ProductVendor_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ProductVendor_AverageLeadTime CHECK N/A Value: ([AverageLeadTime] >= 1)
Check constraint [AverageLeadTime]>=(1)
CK_ProductVendor_StandardPrice CHECK N/A Value: ([StandardPrice] > 0.00)
Check constraint [StandardPrice]>(0.00)
CK_ProductVendor_LastReceiptCost CHECK N/A Value: ([LastReceiptCost] > 0.00)
Check constraint [LastReceiptCost]>(0.00)
CK_ProductVendor_MinOrderQty CHECK N/A Value: ([MinOrderQty] >= 1)
Check constraint [MinOrderQty]>=(1)
CK_ProductVendor_MaxOrderQty CHECK N/A Value: ([MaxOrderQty] >= 1)
Check constraint [MaxOrderQty]>=(1)
CK_ProductVendor_OnOrderQty CHECK N/A Value: ([OnOrderQty] >= 0)
Check constraint [OnOrderQty]>=(0)
PK_ProductVendor_ProductID_VendorID PRIMARY KEY ProductID
VendorID 		Clustered index created by a primary key constraint.
FK_ProductVendor_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
FK_ProductVendor_UnitMeasure_UnitMeasureCode FOREIGN KEY UnitMeasureCode Reference table: Production.UnitMeasure
Foreign key constraint referencing UnitMeasure.UnitMeasureCode.
FK_ProductVendor_Vendor_VendorID FOREIGN KEY VendorID Reference table: Purchasing.Vendor
Foreign key constraint referencing Vendor.VendorID.

Indices

Name | Description
IX_ProductVendor_UnitMeasureCode | Nonclustered index.
IX_ProductVendor_VendorID | Nonclustered index.

Triggers

Name | Description
Purchasing.uProductVendor | AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.

Modified by

Name | Description
Purchasing.uProductVendor | AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.

Applies to

Tables | User


Purchasing.PurchaseOrderDetail

Source code
Object type: Table

Individual products associated with a specific purchase order. See PurchaseOrderHeader.

Columns

Name | Data type | Nullable | Description
PurchaseOrderID | int | No | Primary key. Foreign key to PurchaseOrderHeader.PurchaseOrderID.
PurchaseOrderDetailID int No Column has identity seed value of 1 with a step value of 1.
Primary key. One line number per purchased product.
DueDate | datetime | No | Date the product is expected to be received.
OrderQty | smallint | No | Quantity ordered.
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
UnitPrice | money | No | Vendor's selling price of a single product.
LineTotal | ISNULL([OrderQty] * [UnitPrice], 0.00) | Yes | Per product subtotal. Computed as OrderQty * UnitPrice.
ReceivedQty | decimal(8, 2) | No | Quantity actually received from the vendor.
RejectedQty | decimal(8, 2) | No | Quantity rejected during inspection.
StockedQty | ISNULL([ReceivedQty] - [RejectedQty], 0.00) | Yes | Quantity accepted into inventory. Computed as ReceivedQty - RejectedQty.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_PurchaseOrderDetail_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_PurchaseOrderDetail_OrderQty CHECK N/A Value: ([OrderQty] > 0)
Check constraint [OrderQty]>(0)
CK_PurchaseOrderDetail_UnitPrice CHECK N/A Value: ([UnitPrice] >= 0.00)
Check constraint [UnitPrice]>=(0.00)
CK_PurchaseOrderDetail_ReceivedQty CHECK N/A Value: ([ReceivedQty] >= 0.00)
Check constraint [ReceivedQty]>=(0.00)
CK_PurchaseOrderDetail_RejectedQty CHECK N/A Value: ([RejectedQty] >= 0.00)
Check constraint [RejectedQty]>=(0.00)
PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID PRIMARY KEY PurchaseOrderID
PurchaseOrderDetailID 		Clustered index created by a primary key constraint.
FK_PurchaseOrderDetail_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID FOREIGN KEY PurchaseOrderID Reference table: Purchasing.PurchaseOrderHeader
Foreign key constraint referencing PurchaseOrderHeader.PurchaseOrderID.

Indices

Name | Description
IX_PurchaseOrderDetail_ProductID | Nonclustered index.

Triggers

Name | Description
Purchasing.iPurchaseOrderDetail | AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.
Purchasing.uPurchaseOrderDetail | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.

Accessed by

Name | Description
Purchasing.uPurchaseOrderDetail | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.

Modified by

Name | Description
Purchasing.uPurchaseOrderDetail | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.

Applies to

Tables | User


Purchasing.PurchaseOrderHeader

Source code
Object type: Table

General purchase order information. See PurchaseOrderDetail.

Columns

Name | Data type | Nullable | Description
PurchaseOrderID int No Column has identity seed value of 1 with a step value of 1.
Primary key.
RevisionNumber tinyint No Default value: 0
Incremental number to track changes to the purchase order over time.
Status tinyint No Default value: 1
Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete
EmployeeID | int | No | Employee who created the purchase order. Foreign key to Employee.EmployeeID.
VendorID | int | No | Vendor with whom the purchase order is placed. Foreign key to Vendor.VendorID.
ShipMethodID | int | No | Shipping method. Foreign key to ShipMethod.ShipMethodID.
OrderDate datetime No Default value: GETDATE()
Purchase order creation date.
ShipDate | datetime | Yes | Estimated shipment date from the vendor.
SubTotal money No Default value: 0.00
Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID.
TaxAmt money No Default value: 0.00
Tax amount.
Freight money No Default value: 0.00
Shipping cost.
TotalDue | ISNULL([SubTotal] + [TaxAmt] + [Freight], 0) PERSISTED | No | Total due to vendor. Computed as Subtotal + TaxAmt + Freight.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_PurchaseOrderHeader_RevisionNumber DEFAULT RevisionNumber Value: 0
Default constraint value of 0
DF_PurchaseOrderHeader_Status DEFAULT Status Value: 1
Default constraint value of 1
DF_PurchaseOrderHeader_OrderDate DEFAULT OrderDate Value: GETDATE()
Default constraint value of GETDATE()
DF_PurchaseOrderHeader_SubTotal DEFAULT SubTotal Value: 0.00
Default constraint value of 0.0
DF_PurchaseOrderHeader_TaxAmt DEFAULT TaxAmt Value: 0.00
Default constraint value of 0.0
DF_PurchaseOrderHeader_Freight DEFAULT Freight Value: 0.00
Default constraint value of 0.0
DF_PurchaseOrderHeader_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_PurchaseOrderHeader_Status CHECK N/A Value: ([Status] BETWEEN 1 AND 4)
Check constraint [Status] BETWEEN (1) AND (4)
CK_PurchaseOrderHeader_ShipDate CHECK N/A Value: (([ShipDate] >= [OrderDate]) OR ([ShipDate] IS NULL) )
Check constraint [ShipDate] >= [OrderDate] OR [ShipDate] IS NULL
CK_PurchaseOrderHeader_SubTotal CHECK N/A Value: ([SubTotal] >= 0.00)
Check constraint [SubTotal]>=(0.00)
CK_PurchaseOrderHeader_TaxAmt CHECK N/A Value: ([TaxAmt] >= 0.00)
Check constraint [TaxAmt]>=(0.00)
CK_PurchaseOrderHeader_Freight CHECK N/A Value: ([Freight] >= 0.00)
Check constraint [Freight]>=(0.00)
PK_PurchaseOrderHeader_PurchaseOrderID | PRIMARY KEY | PurchaseOrderID | Clustered index created by a primary key constraint.
FK_PurchaseOrderHeader_Employee_EmployeeID FOREIGN KEY EmployeeID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.EmployeeID.
FK_PurchaseOrderHeader_Vendor_VendorID FOREIGN KEY VendorID Reference table: Purchasing.Vendor
Foreign key constraint referencing Vendor.VendorID.
FK_PurchaseOrderHeader_ShipMethod_ShipMethodID FOREIGN KEY ShipMethodID Reference table: Purchasing.ShipMethod
Foreign key constraint referencing ShipMethod.ShipMethodID.

Indices

Name | Description
IX_PurchaseOrderHeader_EmployeeID | Nonclustered index.
IX_PurchaseOrderHeader_VendorID | Nonclustered index.

Triggers

Name | Description
Purchasing.uPurchaseOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.

Linked tables

Name | Description
Purchasing.PurchaseOrderDetail | Individual products associated with a specific purchase order. See PurchaseOrderHeader.

Accessed by

Name | Description
Purchasing.iPurchaseOrderDetail | AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.

Modified by

Name | Description
Purchasing.iPurchaseOrderDetail | AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.
Purchasing.uPurchaseOrderDetail | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.
Purchasing.uPurchaseOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.

Applies to

Tables | User


Purchasing.ShipMethod

Source code
Object type: Table

Shipping company lookup table.

Columns

Name | Data type | Nullable | Description
ShipMethodID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ShipMethod records.
Name | Name | No | Shipping company name.
ShipBase money No Default value: 0.00
Minimum shipping charge.
ShipRate money No Default value: 0.00
Shipping charge per pound.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ShipMethod_ShipBase DEFAULT ShipBase Value: 0.00
Default constraint value of 0.0
DF_ShipMethod_ShipRate DEFAULT ShipRate Value: 0.00
Default constraint value of 0.0
DF_ShipMethod_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_ShipMethod_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ShipMethod_ShipBase CHECK N/A Value: ([ShipBase] > 0.00)
Check constraint [ShipBase]>(0.00)
CK_ShipMethod_ShipRate CHECK N/A Value: ([ShipRate] > 0.00)
Check constraint [ShipRate]>(0.00)
PK_ShipMethod_ShipMethodID | PRIMARY KEY | ShipMethodID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_ShipMethod_Name | Unique nonclustered index.
AK_ShipMethod_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Purchasing.uShipMethod | AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.

Linked tables

Name | Description
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.
Sales.SalesOrderHeader | General sales order information.

Accessed by

Name | Description
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.

Modified by

Name | Description
Purchasing.uShipMethod | AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.

Applies to

Tables | User


Purchasing.Vendor

Source code
Object type: Table

Companies from whom Adventure Works Cycles purchases parts or other goods.

Columns

Name | Data type | Nullable | Description
VendorID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Vendor records.
AccountNumber | AccountNumber | No | Vendor account (identification) number.
Name | Name | No | Company name.
CreditRating | tinyint | No | 1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average
PreferredVendorStatus Flag No Default value: 1
0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product.
ActiveFlag Flag No Default value: 1
0 = Vendor no longer used. 1 = Vendor is actively used.
PurchasingWebServiceURL | nvarchar(1024) | Yes | Vendor URL.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Vendor_PreferredVendorStatus DEFAULT PreferredVendorStatus Value: 1
Default constraint value of 1 (TRUE)
DF_Vendor_ActiveFlag DEFAULT ActiveFlag Value: 1
Default constraint value of 1 (TRUE)
DF_Vendor_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Vendor_CreditRating CHECK N/A Value: ([CreditRating] BETWEEN 1 AND 5)
Check constraint [CreditRating] BETWEEN (1) AND (5)
PK_Vendor_VendorID | PRIMARY KEY | VendorID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Vendor_AccountNumber | Unique nonclustered index.

Triggers

Name | Description
Purchasing.dVendor | INSTEAD OF DELETE trigger which keeps Vendors from being deleted.
Purchasing.uVendor | AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.

Linked tables

Name | Description
Purchasing.ProductVendor | Cross-reference table mapping vendors with the products they supply.
Purchasing.PurchaseOrderHeader | General purchase order information. See PurchaseOrderDetail.
Purchasing.VendorAddress | Cross-reference mapping vendors and addresses.
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.

Accessed by

Name | Description
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.

Modified by

Name | Description
Purchasing.uVendor | AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.

Applies to

Tables | User


Purchasing.VendorAddress

Source code
Object type: Table

Cross-reference mapping vendors and addresses.

Columns

Name | Data type | Nullable | Description
VendorID | int | No | Primary key. Foreign key to Vendor.VendorID.
AddressID | int | No | Primary key. Foreign key to Address.AddressID.
AddressTypeID | int | No | Address type. Foreign key to AddressType.AddressTypeID.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_VendorAddress_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_VendorAddress_VendorID_AddressID PRIMARY KEY VendorID
AddressID 		Clustered index created by a primary key constraint.
FK_VendorAddress_Address_AddressID FOREIGN KEY AddressID Reference table: Person.Address
Foreign key constraint referencing Address.AddressID.
FK_VendorAddress_AddressType_AddressTypeID FOREIGN KEY AddressTypeID Reference table: Person.AddressType
Foreign key constraint referencing AddressType.AddressTypeID.
FK_VendorAddress_Vendor_VendorID FOREIGN KEY VendorID Reference table: Purchasing.Vendor
Foreign key constraint referencing Vendor.VendorID.

Indices

Name | Description
IX_VendorAddress_AddressID | Nonclustered index.

Triggers

Name | Description
Purchasing.uVendorAddress | AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.

Accessed by

Name | Description
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.

Modified by

Name | Description
Purchasing.uVendorAddress | AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.

Applies to

Tables | User


Purchasing.VendorContact

Source code
Object type: Table

Cross-reference table mapping vendors and their employees.

Columns

Name | Data type | Nullable | Description
VendorID | int | No | Primary key.
ContactID | int | No | Contact (Vendor employee) identification number. Foreign key to Contact.ContactID.
ContactTypeID | int | No | Contact type such as sales manager, or sales agent.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_VendorContact_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_VendorContact_VendorID_ContactID PRIMARY KEY VendorID
ContactID 		Clustered index created by a primary key constraint.
FK_VendorContact_Contact_ContactID FOREIGN KEY ContactID Reference table: Person.Contact
Foreign key constraint referencing Contact.ContactID.
FK_VendorContact_ContactType_ContactTypeID FOREIGN KEY ContactTypeID Reference table: Person.ContactType
Foreign key constraint referencing ContactType.ContactTypeID.
FK_VendorContact_Vendor_VendorID FOREIGN KEY VendorID Reference table: Purchasing.Vendor
Foreign key constraint referencing Vendor.VendorID.

Indices

Name | Description
IX_VendorContact_ContactID | Nonclustered index.
IX_VendorContact_ContactTypeID | Nonclustered index.

Triggers

Name | Description
Purchasing.uVendorContact | AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.

Accessed by

Name | Description
dbo.ufnGetContactInformation | Table value function returning the first name, last name, job title and contact type for a given contact.
Purchasing.vVendor | Vendor (company) names and addresses and the names of vendor employees to contact.

Modified by

Name | Description
Purchasing.uVendorContact | AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.

Applies to

Tables | User


Sales.ContactCreditCard

Source code
Object type: Table

Cross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table.

Columns

Name | Data type | Nullable | Description
ContactID | int | No | Customer identification number. Foreign key to Contact.ContactID.
CreditCardID | int | No | Credit card identification number. Foreign key to CreditCard.CreditCardID.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_ContactCreditCard_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_ContactCreditCard_ContactID_CreditCardID PRIMARY KEY ContactID
CreditCardID 		Clustered index created by a primary key constraint.
FK_ContactCreditCard_Contact_ContactID FOREIGN KEY ContactID Reference table: Person.Contact
Foreign key constraint referencing Contact.ContactID.
FK_ContactCreditCard_CreditCard_CreditCardID FOREIGN KEY CreditCardID Reference table: Sales.CreditCard
Foreign key constraint referencing CreditCard.CreditCardID.

Triggers

Name | Description
Sales.uContactCreditCard | AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.

Modified by

Name | Description
Sales.uContactCreditCard | AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.

Applies to

Tables | User


Sales.CountryRegionCurrency

Source code
Object type: Table

Cross-reference table mapping ISO currency codes to a country or region.

Columns

Name | Data type | Nullable | Description
CountryRegionCode | nvarchar(3) | No | ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode.
CurrencyCode | nchar(3) | No | ISO standard currency code. Foreign key to Currency.CurrencyCode.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_CountryRegionCurrency_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode PRIMARY KEY CountryRegionCode
CurrencyCode 		Clustered index created by a primary key constraint.
FK_CountryRegionCurrency_CountryRegion_CountryRegionCode FOREIGN KEY CountryRegionCode Reference table: Person.CountryRegion
Foreign key constraint referencing CountryRegion.CountryRegionCode.
FK_CountryRegionCurrency_Currency_CurrencyCode FOREIGN KEY CurrencyCode Reference table: Sales.Currency
Foreign key constraint referencing Currency.CurrencyCode.

Indices

Name | Description
IX_CountryRegionCurrency_CurrencyCode | Nonclustered index.

Triggers

Name | Description
Sales.uCountryRegionCurrency | AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.

Modified by

Name | Description
Sales.uCountryRegionCurrency | AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.

Applies to

Tables | User


Sales.CreditCard

Source code
Object type: Table

Customer credit card information.

Columns

Name | Data type | Nullable | Description
CreditCardID int No Column has identity seed value of 1 with a step value of 1.
Primary key for CreditCard records.
CardType | nvarchar(50) | No | Credit card name.
CardNumber | nvarchar(25) | No | Credit card number.
ExpMonth | tinyint | No | Credit card expiration month.
ExpYear | smallint | No | Credit card expiration year.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_CreditCard_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_CreditCard_CreditCardID | PRIMARY KEY | CreditCardID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_CreditCard_CardNumber | Unique nonclustered index.

Triggers

Name | Description
Sales.uCreditCard | AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.

Linked tables

Name | Description
Sales.ContactCreditCard | Cross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table.
Sales.SalesOrderHeader | General sales order information.

Modified by

Name | Description
Sales.uCreditCard | AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.

Applies to

Tables | User


Sales.Currency

Source code
Object type: Table

Lookup table containing standard ISO currencies.

Columns

Name | Data type | Nullable | Description
CurrencyCode | nchar(3) | No | The ISO code for the Currency.
Name | Name | No | Currency name.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Currency_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Currency_CurrencyCode | PRIMARY KEY | CurrencyCode | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_Currency_Name | Unique nonclustered index.

Triggers

Name | Description
Sales.uCurrency | AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.

Linked tables

Name | Description
Sales.CountryRegionCurrency | Cross-reference table mapping ISO currency codes to a country or region.
Sales.CurrencyRate | Currency exchange rates.

Modified by

Name | Description
Sales.uCurrency | AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.

Applies to

Tables | User


Sales.CurrencyRate

Source code
Object type: Table

Currency exchange rates.

Columns

Name | Data type | Nullable | Description
CurrencyRateID int No Column has identity seed value of 1 with a step value of 1.
Primary key for CurrencyRate records.
CurrencyRateDate | datetime | No | Date and time the exchange rate was obtained.
FromCurrencyCode | nchar(3) | No | Exchange rate was converted from this currency code.
ToCurrencyCode | nchar(3) | No | Exchange rate was converted to this currency code.
AverageRate | money | No | Average exchange rate for the day.
EndOfDayRate | money | No | Final exchange rate for the day.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_CurrencyRate_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_CurrencyRate_CurrencyRateID | PRIMARY KEY | CurrencyRateID | Clustered index created by a primary key constraint.
FK_CurrencyRate_Currency_FromCurrencyCode FOREIGN KEY FromCurrencyCode Reference table: Sales.Currency
Foreign key constraint referencing Currency.FromCurrencyCode.
FK_CurrencyRate_Currency_ToCurrencyCode FOREIGN KEY ToCurrencyCode Reference table: Sales.Currency
Foreign key constraint referencing Currency.ToCurrencyCode.

Indices

Name | Description
AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode | Unique nonclustered index.

Triggers

Name | Description
Sales.uCurrencyRate | AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.

Linked tables

Name | Description
Sales.SalesOrderHeader | General sales order information.

Modified by

Name | Description
Sales.uCurrencyRate | AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.

Applies to

Tables | User


Sales.Customer

Source code
Object type: Table

Current customer information. Also see the Individual and Store tables.

Columns

Name | Data type | Nullable | Description
CustomerID int No Column has identity seed value of 1 with a step value of 1.
Primary key for Customer records.
TerritoryID | int | Yes | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.
AccountNumber | ISNULL('AW' + [dbo].[ufnLeadingZeros](CustomerID) , '') | Yes | Unique number identifying the customer assigned by the accounting system.
CustomerType | nchar(1) | No | Customer type: I = Individual, S = Store
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Customer_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_Customer_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_Customer_CustomerType CHECK N/A Value: (UPPER([CustomerType]) IN ('S', 'I') )
Check constraint [CustomerType]='I' OR [CustomerType]='i' OR [CustomerType]='S' OR [CustomerType]='s'
PK_Customer_CustomerID | PRIMARY KEY | CustomerID | Clustered index created by a primary key constraint.
FK_Customer_SalesTerritory_TerritoryID FOREIGN KEY TerritoryID Reference table: Sales.SalesTerritory
Foreign key constraint referencing SalesTerritory.TerritoryID.

Indices

Name | Description
AK_Customer_AccountNumber | Unique nonclustered index.
AK_Customer_rowguid | Unique nonclustered index. Used to support replication samples.
IX_Customer_TerritoryID | Nonclustered index.

Triggers

Name | Description
Sales.uCustomer | AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.

Linked tables

Name | Description
Sales.CustomerAddress | Cross-reference table mapping customers to their address(es).
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.
Sales.SalesOrderHeader | General sales order information.
Sales.Store | Customers (resellers) of Adventure Works products.

Accessed by

Name | Description
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Sales.uCustomer | AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.

Applies to

Tables | User


Sales.CustomerAddress

Source code
Object type: Table

Cross-reference table mapping customers to their address(es).

Columns

Name | Data type | Nullable | Description
CustomerID | int | No | Primary key. Foreign key to Customer.CustomerID.
AddressID | int | No | Primary key. Foreign key to Address.AddressID.
AddressTypeID | int | No | Address type. Foreign key to AddressType.AddressTypeID.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_CustomerAddress_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_CustomerAddress_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_CustomerAddress_CustomerID_AddressID PRIMARY KEY CustomerID
AddressID 		Clustered index created by a primary key constraint.
FK_CustomerAddress_Address_AddressID FOREIGN KEY AddressID Reference table: Person.Address
Foreign key constraint referencing Address.AddressID.
FK_CustomerAddress_AddressType_AddressTypeID FOREIGN KEY AddressTypeID Reference table: Person.AddressType
Foreign key constraint referencing AddressType.AddressTypeID.
FK_CustomerAddress_Customer_CustomerID FOREIGN KEY CustomerID Reference table: Sales.Customer
Foreign key constraint referencing Customer.CustomerID.

Indices

Name | Description
AK_CustomerAddress_rowguid | Unique nonclustered index. Used to support replication samples.

Triggers

Name | Description
Sales.uCustomerAddress | AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.

Accessed by

Name | Description
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Sales.uCustomerAddress | AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.

Applies to

Tables | User


Sales.Individual

Source code
Object type: Table

Demographic data about customers that purchase Adventure Works products online.

Columns

Name | Data type | Nullable | Description
CustomerID | int | No | Unique customer identification number. Foreign key to Customer.CustomerID.
ContactID | int | No | Identifies the customer in the Contact table. Foreign key to Contact.ContactID.
Demographics | XML(Sales.IndividualSurveySchemaCollection) | Yes | Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Individual_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Individual_CustomerID | PRIMARY KEY | CustomerID | Clustered index created by a primary key constraint.
FK_Individual_Customer_CustomerID FOREIGN KEY CustomerID Reference table: Sales.Customer
Foreign key constraint referencing Customer.CustomerID.
FK_Individual_Contact_ContactID FOREIGN KEY ContactID Reference table: Person.Contact
Foreign key constraint referencing Contact.ContactID.

Indices

Name | Description
PXML_Individual_Demographics | Primary XML index.
XMLPATH_Individual_Demographics | Secondary XML index for path.
XMLPROPERTY_Individual_Demographics | Secondary XML index for property.
XMLVALUE_Individual_Demographics | Secondary XML index for value.

Triggers

Name | Description
Sales.iuIndividual | AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.

Accessed by

Name | Description
dbo.ufnGetContactInformation | Table value function returning the first name, last name, job title and contact type for a given contact.
Sales.vIndividual | Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Sales.vIndividualDemographics | Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.

Modified by

Name | Description
Sales.iduSalesOrderDetail | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.
Sales.iuIndividual | AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.

Applies to

Tables | User


Sales.SalesOrderDetail

Source code
Object type: Table

Individual products associated with a specific sales order. See SalesOrderHeader.

Columns

Name | Data type | Nullable | Description
SalesOrderID | int | No | Primary key. Foreign key to SalesOrderHeader.SalesOrderID.
SalesOrderDetailID int No Column has identity seed value of 1 with a step value of 1.
Primary key. One line number per product sold.
CarrierTrackingNumber | nvarchar(25) | Yes | Shipment tracking number supplied by the shipper.
OrderQty | smallint | No | Quantity ordered per product.
ProductID | int | No | Product sold to customer. Foreign key to Product.ProductID.
SpecialOfferID | int | No | Promotional code. Foreign key to SpecialOffer.SpecialOfferID.
UnitPrice | money | No | Selling price of a single product.
UnitPriceDiscount money No Default value: 0.0
Discount amount.
LineTotal | ISNULL([UnitPrice] * (1.0 - [UnitPriceDiscount]) * [OrderQty], 0.0) | Yes | Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_SalesOrderDetail_UnitPriceDiscount DEFAULT UnitPriceDiscount Value: 0.0
Default constraint value of 0.0
DF_SalesOrderDetail_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesOrderDetail_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesOrderDetail_OrderQty CHECK N/A Value: ([OrderQty] > 0)
Check constraint [OrderQty]>(0)
CK_SalesOrderDetail_UnitPrice CHECK N/A Value: ([UnitPrice] >= 0.00)
Check constraint [UnitPrice]>=(0.00)
CK_SalesOrderDetail_UnitPriceDiscount CHECK N/A Value: ([UnitPriceDiscount] >= 0.00)
Check constraint [UnitPriceDiscount]>=(0.00)
PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID PRIMARY KEY SalesOrderID
SalesOrderDetailID 		Clustered index created by a primary key constraint.
FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID FOREIGN KEY SalesOrderID Reference table: Sales.SalesOrderHeader
Foreign key constraint referencing SalesOrderHeader.PurchaseOrderID.
FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID FOREIGN KEY SpecialOfferID
ProductID 		Reference table: Sales.SpecialOfferProduct
Foreign key constraint referencing SpecialOfferProduct.SpecialOfferIDProductID.

Indices

Name | Description
AK_SalesOrderDetail_rowguid | Unique nonclustered index.Used to support replication samples.
IX_SalesOrderDetail_ProductID | Nonclustered index.

Triggers

Name | Description
Sales.iduSalesOrderDetail | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.

Accessed by

Name | Description
Company Sales | Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.

Modified by

Name | Description
Sales.iduSalesOrderDetail | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.

Applies to

Tables | User


Sales.SalesOrderHeader

Source code
Object type: Table

General sales order information.

Columns

Name | Data type | Nullable | Description
SalesOrderID int No Column has identity seed value of 1 with a step value of 1.
Primary key.
RevisionNumber tinyint No Default value: 0
Incremental number to track changes to the sales order over time.
OrderDate datetime No Default value: GETDATE()
Dates the sales order was created.
DueDate | datetime | No | Date the order is due to the customer.
ShipDate | datetime | Yes | Date the order was shipped to the customer.
Status tinyint No Default value: 1
Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled
OnlineOrderFlag Flag No Default value: 1
0 = Order placed by sales person. 1 = Order placed online by customer.
SalesOrderNumber | ISNULL(N'SO' + CONVERT(nvarchar(23) , [SalesOrderID]) , N'*** ERROR ***') | Yes | Unique sales order identification number.
PurchaseOrderNumber | OrderNumber | Yes | Customer purchase order number reference.
AccountNumber | AccountNumber | Yes | Financial accounting number reference.
CustomerID | int | No | Customer identification number. Foreign key to Customer.CustomerID.
ContactID | int | No | Customer contact identification number. Foreign key to Contact.ContactID.
SalesPersonID | int | Yes | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.
TerritoryID | int | Yes | Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.
BillToAddressID | int | No | Customer billing address. Foreign key to Address.AddressID.
ShipToAddressID | int | No | Customer shipping address. Foreign key to Address.AddressID.
ShipMethodID | int | No | Shipping method. Foreign key to ShipMethod.ShipMethodID.
CreditCardID | int | Yes | Credit card identification number. Foreign key to CreditCard.CreditCardID.
CreditCardApprovalCode | varchar(15) | Yes | Approval code provided by the credit card company.
CurrencyRateID | int | Yes | Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.
SubTotal money No Default value: 0.00
Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.
TaxAmt money No Default value: 0.00
Tax amount.
Freight money No Default value: 0.00
Shipping cost.
TotalDue | ISNULL([SubTotal] + [TaxAmt] + [Freight], 0) | Yes | Total due from customer. Computed as Subtotal + TaxAmt + Freight.
Comment | nvarchar(128) | Yes | Sales representative comments.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_SalesOrderHeader_RevisionNumber DEFAULT RevisionNumber Value: 0
Default constraint value of 0
DF_SalesOrderHeader_OrderDate DEFAULT OrderDate Value: GETDATE()
Default constraint value of GETDATE()
DF_SalesOrderHeader_Status DEFAULT Status Value: 1
Default constraint value of 1
DF_SalesOrderHeader_OnlineOrderFlag DEFAULT OnlineOrderFlag Value: 1
Default constraint value of 1 (TRUE)
DF_SalesOrderHeader_SubTotal DEFAULT SubTotal Value: 0.00
Default constraint value of 0.0
DF_SalesOrderHeader_TaxAmt DEFAULT TaxAmt Value: 0.00
Default constraint value of 0.0
DF_SalesOrderHeader_Freight DEFAULT Freight Value: 0.00
Default constraint value of 0.0
DF_SalesOrderHeader_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesOrderHeader_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesOrderHeader_Status CHECK N/A Value: ([Status] BETWEEN 0 AND 8)
Check constraint [Status] BETWEEN (0) AND (8)
CK_SalesOrderHeader_DueDate CHECK N/A Value: ([DueDate] >= [OrderDate])
Check constraint [DueDate] >= [OrderDate]
CK_SalesOrderHeader_ShipDate CHECK N/A Value: (([ShipDate] >= [OrderDate]) OR ([ShipDate] IS NULL) )
Check constraint [ShipDate] >= [OrderDate] OR [ShipDate] IS NULL
CK_SalesOrderHeader_SubTotal CHECK N/A Value: ([SubTotal] >= 0.00)
Check constraint [SubTotal]>=(0.00)
CK_SalesOrderHeader_TaxAmt CHECK N/A Value: ([TaxAmt] >= 0.00)
Check constraint [TaxAmt]>=(0.00)
CK_SalesOrderHeader_Freight CHECK N/A Value: ([Freight] >= 0.00)
Check constraint [Freight]>=(0.00)
PK_SalesOrderHeader_SalesOrderID | PRIMARY KEY | SalesOrderID | Clustered index created by a primary key constraint.
FK_SalesOrderHeader_Address_BillToAddressID FOREIGN KEY BillToAddressID Reference table: Person.Address
Foreign key constraint referencing Address.AddressID.
FK_SalesOrderHeader_Address_ShipToAddressID FOREIGN KEY ShipToAddressID Reference table: Person.Address
Foreign key constraint referencing Address.AddressID.
FK_SalesOrderHeader_Contact_ContactID FOREIGN KEY ContactID Reference table: Person.Contact
Foreign key constraint referencing Contact.ContactID.
FK_SalesOrderHeader_CreditCard_CreditCardID FOREIGN KEY CreditCardID Reference table: Sales.CreditCard
Foreign key constraint referencing CreditCard.CreditCardID.
FK_SalesOrderHeader_CurrencyRate_CurrencyRateID FOREIGN KEY CurrencyRateID Reference table: Sales.CurrencyRate
Foreign key constraint referencing CurrencyRate.CurrencyRateID.
FK_SalesOrderHeader_Customer_CustomerID FOREIGN KEY CustomerID Reference table: Sales.Customer
Foreign key constraint referencing Customer.CustomerID.
FK_SalesOrderHeader_SalesPerson_SalesPersonID FOREIGN KEY SalesPersonID Reference table: Sales.SalesPerson
Foreign key constraint referencing SalesPerson.SalesPersonID.
FK_SalesOrderHeader_ShipMethod_ShipMethodID FOREIGN KEY ShipMethodID Reference table: Purchasing.ShipMethod
Foreign key constraint referencing ShipMethod.ShipMethodID.
FK_SalesOrderHeader_SalesTerritory_TerritoryID FOREIGN KEY TerritoryID Reference table: Sales.SalesTerritory
Foreign key constraint referencing SalesTerritory.TerritoryID.

Indices

Name | Description
AK_SalesOrderHeader_rowguid | Unique nonclustered index.Used to support replication samples.
AK_SalesOrderHeader_SalesOrderNumber | Unique nonclustered index.
IX_SalesOrderHeader_CustomerID | Nonclustered index.
IX_SalesOrderHeader_SalesPersonID | Nonclustered index.>

Triggers

Name | Description
Sales.uSalesOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.

Linked tables

Name | Description
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeaderSalesReason | Cross-reference table mapping sales orders to sales reason codes.

Accessed by

Name | Description
Company Sales | Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images.
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.iduSalesOrderDetail | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.
Sales.vSalesPersonSalesByFiscalYears | Uses PIVOT to return aggregated sales information for each sales representative.
Territory Sales Drilldown | Adventure Works sales by territory. This report drills down through salesperson and order number with drillthrough to individual orders. This report illustrates the use of a table data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of drillthrough links and conditional formatting.

Modified by

Name | Description
Sales.iduSalesOrderDetail | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.
Sales.uSalesOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.

Applies to

Tables | User


Sales.SalesOrderHeaderSalesReason

Source code
Object type: Table

Cross-reference table mapping sales orders to sales reason codes.

Columns

Name | Data type | Nullable | Description
SalesOrderID | int | No | Primary key. Foreign key to SalesOrderHeader.SalesOrderID.
SalesReasonID | int | No | Primary key. Foreign key to SalesReason.SalesReasonID.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_SalesOrderHeaderSalesReason_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID PRIMARY KEY SalesOrderID
SalesReasonID 		Clustered index created by a primary key constraint.
FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID FOREIGN KEY SalesReasonID Reference table: Sales.SalesReason
Foreign key constraint referencing SalesReason.SalesReasonID.
FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID FOREIGN KEY SalesOrderID Reference table: Sales.SalesOrderHeader
Foreign key constraint referencing SalesOrderHeader.SalesOrderID.

Triggers

Name | Description
Sales.uSalesOrderHeaderSalesReason | AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.

Modified by

Name | Description
Sales.uSalesOrderHeaderSalesReason | AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.

Applies to

Tables | User


Sales.SalesPerson

Source code
Object type: Table

Sales representative current information.

Columns

Name | Data type | Nullable | Description
SalesPersonID | int | No | Primary key for SalesPerson records.
TerritoryID | int | Yes | Territory currently assigned to. Foreign key to SalesTerritory.SalesTerritoryID.
SalesQuota | money | Yes | Projected yearly sales.
Bonus money No Default value: 0.00
Bonus due if quota is met.
CommissionPct smallmoney No Default value: 0.00
Commision percent received per sale.
SalesYTD money No Default value: 0.00
Sales total year to date.
SalesLastYear money No Default value: 0.00
Sales total of previous year.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_SalesPerson_Bonus DEFAULT Bonus Value: 0.00
Default constraint value of 0.0
DF_SalesPerson_CommissionPct DEFAULT CommissionPct Value: 0.00
Default constraint value of 0.0
DF_SalesPerson_SalesYTD DEFAULT SalesYTD Value: 0.00
Default constraint value of 0.0
DF_SalesPerson_SalesLastYear DEFAULT SalesLastYear Value: 0.00
Default constraint value of 0.0
DF_SalesPerson_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesPerson_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesPerson_SalesQuota CHECK N/A Value: ([SalesQuota] > 0.00)
Check constraint [SalesQuota]>(0.00)
CK_SalesPerson_Bonus CHECK N/A Value: ([Bonus] >= 0.00)
Check constraint [Bonus]>=(0.00)
CK_SalesPerson_CommissionPct CHECK N/A Value: ([CommissionPct] >= 0.00)
Check constraint [CommissionPct]>=(0.00)
CK_SalesPerson_SalesYTD CHECK N/A Value: ([SalesYTD] >= 0.00)
Check constraint [SalesYTD]>=(0.00)
CK_SalesPerson_SalesLastYear CHECK N/A Value: ([SalesLastYear] >= 0.00)
Check constraint [SalesLastYear]>=(0.00)
PK_SalesPerson_SalesPersonID | PRIMARY KEY | SalesPersonID | Clustered index created by a primary key constraint.
FK_SalesPerson_Employee_SalesPersonID FOREIGN KEY SalesPersonID Reference table: HumanResources.Employee
Foreign key constraint referencing Employee.EmployeeID.
FK_SalesPerson_SalesTerritory_TerritoryID FOREIGN KEY TerritoryID Reference table: Sales.SalesTerritory
Foreign key constraint referencing SalesTerritory.TerritoryID.

Indices

Name | Description
AK_SalesPerson_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Sales.uSalesPerson | AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.

Linked tables

Name | Description
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPersonQuotaHistory | Sales performance tracking.
Sales.SalesTerritoryHistory | Sales representative transfers to other sales territories.
Sales.Store | Customers (resellers) of Adventure Works products.

Accessed by

Name | Description
Employee Sales Summary | Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vSalesPersonSalesByFiscalYears | Uses PIVOT to return aggregated sales information for each sales representative.
Territory Sales Drilldown | Adventure Works sales by territory. This report drills down through salesperson and order number with drillthrough to individual orders. This report illustrates the use of a table data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of drillthrough links and conditional formatting.

Modified by

Name | Description
Sales.uSalesOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.
Sales.uSalesPerson | AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.

Applies to

Tables | User


Sales.SalesPersonQuotaHistory

Source code
Object type: Table

Sales performance tracking.

Columns

Name | Data type | Nullable | Description
SalesPersonID | int | No | Sales person identification number. Foreign key to SalesPerson.SalesPersonID.
QuotaDate | datetime | No | Sales quota date.
SalesQuota | money | No | Sales quota amount.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_SalesPersonQuotaHistory_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesPersonQuotaHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesPersonQuotaHistory_SalesQuota CHECK N/A Value: ([SalesQuota] > 0.00)
Check constraint [SalesQuota]>(0.00)
PK_SalesPersonQuotaHistory_SalesPersonID_QuotaDate PRIMARY KEY SalesPersonID
QuotaDate 		Clustered index created by a primary key constraint.
FK_SalesPersonQuotaHistory_SalesPerson_SalesPersonID FOREIGN KEY SalesPersonID Reference table: Sales.SalesPerson
Foreign key constraint referencing SalesPerson.SalesPersonID.

Indices

Name | Description
AK_SalesPersonQuotaHistory_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Sales.uSalesPersonQuotaHistory | AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.

Modified by

Name | Description
Sales.uSalesPersonQuotaHistory | AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.

Applies to

Tables | User


Sales.SalesReason

Source code
Object type: Table

Lookup table of customer purchase reasons.

Columns

Name | Data type | Nullable | Description
SalesReasonID int No Column has identity seed value of 1 with a step value of 1.
Primary key for SalesReason records.
Name | Name | No | Sales reason description.
ReasonType | Name | No | Category the sales reason belongs to.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_SalesReason_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_SalesReason_SalesReasonID | PRIMARY KEY | SalesReasonID | Clustered index created by a primary key constraint.

Triggers

Name | Description
Sales.uSalesReason | AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.

Linked tables

Name | Description
Sales.SalesOrderHeaderSalesReason | Cross-reference table mapping sales orders to sales reason codes.

Modified by

Name | Description
Sales.uSalesReason | AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.

Applies to

Tables | User


Sales.SalesTaxRate

Source code
Object type: Table

Tax rate lookup table.

Columns

Name | Data type | Nullable | Description
SalesTaxRateID int No Column has identity seed value of 1 with a step value of 1.
Primary key for SalesTaxRate records.
StateProvinceID | int | No | State, province, or country/region the sales tax applies to.
TaxType | tinyint | No | 1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions.
TaxRate smallmoney No Default value: 0.00
Tax rate amount.
Name | Name | No | Tax rate description.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_SalesTaxRate_TaxRate DEFAULT TaxRate Value: 0.00
Default constraint value of 0.0
DF_SalesTaxRate_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesTaxRate_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesTaxRate_TaxType CHECK N/A Value: ([TaxType] BETWEEN 1 AND 3)
Check constraint [TaxType] BETWEEN (1) AND (3)
PK_SalesTaxRate_SalesTaxRateID | PRIMARY KEY | SalesTaxRateID | Clustered index created by a primary key constraint.
FK_SalesTaxRate_StateProvince_StateProvinceID FOREIGN KEY StateProvinceID Reference table: Person.StateProvince
Foreign key constraint referencing StateProvince.StateProvinceID.

Indices

Name | Description
AK_SalesTaxRate_rowguid | Unique nonclustered index.Used to support replication samples.
AK_SalesTaxRate_StateProvinceID_TaxType | Unique nonclustered index.

Triggers

Name | Description
Sales.uSalesTaxRate | AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.

Modified by

Name | Description
Sales.uSalesTaxRate | AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.

Applies to

Tables | User


Sales.SalesTerritory

Source code
Object type: Table

Sales territory lookup table.

Columns

Name | Data type | Nullable | Description
TerritoryID int No Column has identity seed value of 1 with a step value of 1.
Primary key for SalesTerritory records.
Name | Name | No | Sales territory description
CountryRegionCode | nvarchar(3) | No | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode.
Group | nvarchar(50) | No | Geographic area to which the sales territory belong.
SalesYTD money No Default value: 0.00
Sales in the territory year to date.
SalesLastYear money No Default value: 0.00
Sales in the territory the previous year.
CostYTD money No Default value: 0.00
Business costs in the territory year to date.
CostLastYear money No Default value: 0.00
Business costs in the territory the previous year.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_SalesTerritory_SalesYTD DEFAULT SalesYTD Value: 0.00
Default constraint value of 0.0
DF_SalesTerritory_SalesLastYear DEFAULT SalesLastYear Value: 0.00
Default constraint value of 0.0
DF_SalesTerritory_CostYTD DEFAULT CostYTD Value: 0.00
Default constraint value of 0.0
DF_SalesTerritory_CostLastYear DEFAULT CostLastYear Value: 0.00
Default constraint value of 0.0
DF_SalesTerritory_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesTerritory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesTerritory_SalesYTD CHECK N/A Value: ([SalesYTD] >= 0.00)
Check constraint [SalesYTD]>=(0.00)
CK_SalesTerritory_SalesLastYear CHECK N/A Value: ([SalesLastYear] >= 0.00)
Check constraint [SalesLastYear]>=(0.00)
CK_SalesTerritory_CostYTD CHECK N/A Value: ([CostYTD] >= 0.00)
Check constraint [CostYTD]>=(0.00)
CK_SalesTerritory_CostLastYear CHECK N/A Value: ([CostLastYear] >= 0.00)
Check constraint [CostLastYear]>=(0.00)
PK_SalesTerritory_TerritoryID | PRIMARY KEY | TerritoryID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_SalesTerritory_Name | Unique nonclustered index.
AK_SalesTerritory_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Sales.uSalesTerritory | AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.

Linked tables

Name | Description
Person.StateProvince | State and province lookup table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritoryHistory | Sales representative transfers to other sales territories.

Accessed by

Name | Description
Sales.vSalesPerson | Sales representiatives (names and addresses) and their sales-related information.
Sales.vSalesPersonSalesByFiscalYears | Uses PIVOT to return aggregated sales information for each sales representative.
Territory Sales Drilldown | Adventure Works sales by territory. This report drills down through salesperson and order number with drillthrough to individual orders. This report illustrates the use of a table data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of drillthrough links and conditional formatting.

Modified by

Name | Description
Sales.uSalesOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.
Sales.uSalesTerritory | AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.

Applies to

Tables | User


Sales.SalesTerritoryHistory

Source code
Object type: Table

Sales representative transfers to other sales territories.

Columns

Name | Data type | Nullable | Description
SalesPersonID | int | No | Primary key for SalesTerritoryHistory records.
TerritoryID | int | No | Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.
StartDate | datetime | No | Date the sales representive started work in the territory.
EndDate | datetime | Yes | Date the sales representative left work in the territory.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_SalesTerritoryHistory_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SalesTerritoryHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SalesTerritoryHistory_EndDate CHECK N/A Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL
PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID PRIMARY KEY SalesPersonID
StartDate
TerritoryID 		Clustered index created by a primary key constraint.
FK_SalesTerritoryHistory_SalesPerson_SalesPersonID FOREIGN KEY SalesPersonID Reference table: Sales.SalesPerson
Foreign key constraint referencing SalesPerson.SalesPersonID.
FK_SalesTerritoryHistory_SalesTerritory_TerritoryID FOREIGN KEY TerritoryID Reference table: Sales.SalesTerritory
Foreign key constraint referencing SalesTerritory.TerritoryID.

Indices

Name | Description
AK_SalesTerritoryHistory_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Sales.uSalesTerritoryHistory | AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.

Modified by

Name | Description
Sales.uSalesTerritoryHistory | AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.

Applies to

Tables | User


Sales.ShoppingCartItem

Source code
Object type: Table

Contains online customer orders until the order is submitted or cancelled.

Columns

Name | Data type | Nullable | Description
ShoppingCartItemID int No Column has identity seed value of 1 with a step value of 1.
Primary key for ShoppingCartItem records.
ShoppingCartID | nvarchar(50) | No | Shopping cart identification number.
Quantity int No Default value: 1
Product quantity ordered.
ProductID | int | No | Product ordered. Foreign key to Product.ProductID.
DateCreated datetime No Default value: GETDATE()
Date the time the record was created.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_ShoppingCartItem_Quantity DEFAULT Quantity Value: 1
Default constraint value of 1
DF_ShoppingCartItem_DateCreated DEFAULT DateCreated Value: GETDATE()
Default constraint value of GETDATE()
DF_ShoppingCartItem_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_ShoppingCartItem_Quantity CHECK N/A Value: ([Quantity] >= 1)
Check constraint [Quantity]>=(1)
PK_ShoppingCartItem_ShoppingCartItemID | PRIMARY KEY | ShoppingCartItemID | Clustered index created by a primary key constraint.
FK_ShoppingCartItem_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.

Indices

Name | Description
IX_ShoppingCartItem_ShoppingCartID_ProductID | Nonclustered index.

Triggers

Name | Description
Sales.uShoppingCartItem | AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.

Modified by

Name | Description
Sales.uShoppingCartItem | AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.

Applies to

Tables | User


Sales.SpecialOffer

Source code
Object type: Table

Sale discounts lookup table.

Columns

Name | Data type | Nullable | Description
SpecialOfferID int No Column has identity seed value of 1 with a step value of 1.
Primary key for SpecialOffer records.
Description | nvarchar(255) | No | Discount description.
DiscountPct smallmoney No Default value: 0.00
Discount precentage.
Type | nvarchar(50) | No | Discount type category.
Category | nvarchar(50) | No | Group the discount applies to such as Reseller or Customer.
StartDate | datetime | No | Discount start date.
EndDate | datetime | No | Discount end date.
MinQty int No Default value: 0
Minimum discount percent allowed.
MaxQty | int | Yes | Maximum discount percent allowed.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_SpecialOffer_DiscountPct DEFAULT DiscountPct Value: 0.00
Default constraint value of 0.0
DF_SpecialOffer_MinQty DEFAULT MinQty Value: 0
Default constraint value of 0.0
DF_SpecialOffer_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SpecialOffer_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
CK_SpecialOffer_EndDate CHECK N/A Value: ([EndDate] >= [StartDate])
Check constraint [EndDate] >= [StartDate]
CK_SpecialOffer_DiscountPct CHECK N/A Value: ([DiscountPct] >= 0.00)
Check constraint [DiscountPct]>=(0.00)
CK_SpecialOffer_MinQty CHECK N/A Value: ([MinQty] >= 0)
Check constraint [MinQty]>=(0)
CK_SpecialOffer_MaxQty CHECK N/A Value: ([MaxQty] >= 0)
Check constraint [MaxQty]>=(0)
PK_SpecialOffer_SpecialOfferID | PRIMARY KEY | SpecialOfferID | Clustered index created by a primary key constraint.

Indices

Name | Description
AK_SpecialOffer_rowguid | Unique nonclustered index.Used to support replication samples.

Triggers

Name | Description
Sales.uSpecialOffer | AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.

Linked tables

Name | Description
Sales.SpecialOfferProduct | Cross-reference table mapping products to special offer discounts.

Modified by

Name | Description
Sales.uSpecialOffer | AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.

Applies to

Tables | User


Sales.SpecialOfferProduct

Source code
Object type: Table

Cross-reference table mapping products to special offer discounts.

Columns

Name | Data type | Nullable | Description
SpecialOfferID | int | No | Primary key for SpecialOfferProduct records.
ProductID | int | No | Product identification number. Foreign key to Product.ProductID.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_SpecialOfferProduct_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_SpecialOfferProduct_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_SpecialOfferProduct_SpecialOfferID_ProductID PRIMARY KEY SpecialOfferID
ProductID 		Clustered index created by a primary key constraint.
FK_SpecialOfferProduct_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID FOREIGN KEY SpecialOfferID Reference table: Sales.SpecialOffer
Foreign key constraint referencing SpecialOffer.SpecialOfferID.

Indices

Name | Description
AK_SpecialOfferProduct_rowguid | Unique nonclustered index.Used to support replication samples.
IX_SpecialOfferProduct_ProductID | Nonclustered index.

Triggers

Name | Description
Sales.uSpecialOfferProduct | AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.

Linked tables

Name | Description
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.

Modified by

Name | Description
Sales.uSpecialOfferProduct | AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.

Applies to

Tables | User


Sales.Store

Source code
Object type: Table

Customers (resellers) of Adventure Works products.

Columns

Name | Data type | Nullable | Description
CustomerID | int | No | Primary key. Foreign key to Customer.CustomerID.
Name | Name | No | Name of the store.
SalesPersonID | int | Yes | ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID.
Demographics | XML(Sales.StoreSurveySchemaCollection) | Yes | Demographic informationg about the store such as the number of employees, annual sales and store type.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name | Type | Columns | Description
DF_Store_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_Store_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_Store_CustomerID | PRIMARY KEY | CustomerID | Clustered index created by a primary key constraint.
FK_Store_Customer_CustomerID FOREIGN KEY CustomerID Reference table: Sales.Customer
Foreign key constraint referencing Customer.CustomerID.
FK_Store_SalesPerson_SalesPersonID FOREIGN KEY SalesPersonID Reference table: Sales.SalesPerson
Foreign key constraint referencing SalesPerson.SalesPersonID

Indices

Name | Description
AK_Store_rowguid | Unique nonclustered index.Used to support replication samples.
IX_Store_SalesPersonID | Nonclustered index.
PXML_Store_Demographics | Primary XML index.

Triggers

Name | Description
Sales.iStore | AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.
Sales.uStore | AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.

Linked tables

Name | Description
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Accessed by

Name | Description
Product Line Sales | Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.
Sales Order Detail | Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Sales.uStore | AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.

Applies to

Tables | User


Sales.StoreContact

Source code
Object type: Table

Cross-reference table mapping stores and their employees.

Columns

Name | Data type | Nullable | Description
CustomerID | int | No | Store identification number. Foreign key to Customer.CustomerID.
ContactID | int | No | Contact (store employee) identification number. Foreign key to Contact.ContactID.
ContactTypeID | int | No | Contact type such as owner or purchasing agent. Foreign key to ContactType.ContactTypeID.
rowguid uniqueidentifier No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.

Constraints

Name Type Columns Description
DF_StoreContact_rowguid DEFAULT rowguid Value: NEWID()
Default constraint value of NEWID()
DF_StoreContact_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()
PK_StoreContact_CustomerID_ContactID PRIMARY KEY CustomerID
ContactID 		Clustered index created by a primary key constraint.
FK_StoreContact_Contact_ContactID FOREIGN KEY ContactID Reference table: Person.Contact
Foreign key constraint referencing Contact.ContactID.
FK_StoreContact_ContactType_ContactTypeID FOREIGN KEY ContactTypeID Reference table: Person.ContactType
Foreign key constraint referencing ContactType.ContactTypeID.
FK_StoreContact_Store_CustomerID FOREIGN KEY CustomerID Reference table: Sales.Store
Foreign key constraint referencing Store.CustomerID.

Indices

Name | Description
AK_StoreContact_rowguid | Unique nonclustered index.Used to support replication samples.
IX_StoreContact_ContactID | Nonclustered index.
IX_StoreContact_ContactTypeID | Nonclustered index.

Triggers

Name | Description
Sales.uStoreContact | AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.

Accessed by

Name | Description
dbo.ufnGetContactInformation | Table value function returning the first name, last name, job title and contact type for a given contact.
Sales.vStoreWithDemographics | Stores (names and addresses) that sell Adventure Works Cycles products to consumers.

Modified by

Name | Description
Sales.uStoreContact | AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.

Applies to

Tables | User


SQL 2005 Adventure Works OLTP - User defined types

User defined types SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following user defined data types are present in this database.

AccountNumber
Flag
Name
NameStyle
OrderNumber
Phone


AccountNumber

Source code
Object type: User defined type

Properties

New data type Derived from Nullable User
AccountNumber nvarchar(15) Yes —

Referring tables

Name | Description
Purchasing.Vendor | Companies from whom Adventure Works Cycles purchases parts or other goods.
Sales.SalesOrderHeader | General sales order information.

Applies to

User defined types


Flag

Source code
Object type: User defined type

Properties

New data type Derived from Nullable User
Flag bit No —

Referring procedures

Name | Description
HumanResources.uspUpdateEmployeeHireInfo | Updates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.
HumanResources.uspUpdateEmployeeLogin | Updates the Employee table with the values specified in the input parameters for the given EmployeeID.

Referring tables

Name | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.StateProvince | State and province lookup table.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductProductPhoto | Cross-reference table mapping products and product photos.
Purchasing.Vendor | Companies from whom Adventure Works Cycles purchases parts or other goods.
Sales.SalesOrderHeader | General sales order information.

Applies to

User defined types


Name

Source code
Object type: User defined type

Properties

New data type Derived from Nullable User
Name nvarchar(50) Yes —

Referring tables

Name | Description
HumanResources.Department | Lookup table containing the departments within the Adventure Works Cycles company.
HumanResources.Shift | Work shift lookup table.
Person.AddressType | Types of addresses stored in the Address table.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.ContactType | Lookup table containing the types of contacts stored in Contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Production.Culture | Lookup table containing the languages in which some AdventureWorks data is stored.
Production.Location | Product inventory and manufacturing locations.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductModel | Product model classification.
Production.ProductReview | Customer reviews of products they have purchased.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Production.ScrapReason | Manufacturing failure reasons lookup table.
Production.UnitMeasure | Unit of measure lookup table.
Purchasing.ShipMethod | Shipping company lookup table.
Purchasing.Vendor | Companies from whom Adventure Works Cycles purchases parts or other goods.
Sales.Currency | Lookup table containing standard ISO currencies.
Sales.SalesReason | Lookup table of customer purchase reasons.
Sales.SalesTaxRate | Tax rate lookup table.
Sales.SalesTerritory | Sales territory lookup table.
Sales.Store | Customers (resellers) of Adventure Works products.

Applies to

User defined types


NameStyle

Source code
Object type: User defined type

Properties

New data type Derived from Nullable User
NameStyle bit No —

Referring tables

Name | Description
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

User defined types


OrderNumber

Source code
Object type: User defined type

Properties

New data type Derived from Nullable User
OrderNumber nvarchar(25) Yes —

Referring tables

Name | Description
Sales.SalesOrderHeader | General sales order information.

Applies to

User defined types


Phone

Source code
Object type: User defined type

Properties

New data type Derived from Nullable User
Phone nvarchar(25) Yes —

Referring tables

Name | Description
Person.Contact | Names of each employee, customer contact, and vendor contact.

Applies to

User defined types


SQL 2005 Adventure Works OLTP - Functions

Functions SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following user defined functions are present for this database.

dbo.ufnGetAccountingEndDate
dbo.ufnGetAccountingStartDate
dbo.ufnGetContactInformation
dbo.ufnGetDocumentStatusText
dbo.ufnGetProductDealerPrice
dbo.ufnGetProductListPrice
dbo.ufnGetProductStandardCost
dbo.ufnGetPurchaseOrderStatusText
dbo.ufnGetSalesOrderStatusText
dbo.ufnGetStock
dbo.ufnLeadingZeros


SQL 2005 Adventure Works OLTP - Multi-value table

Multi-value table SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following functions return a multi-statement table structure.

dbo.ufnGetContactInformation


dbo.ufnGetContactInformation

Source code
Object type: User defined function

Table value function returning the first name, last name, job title and contact type for a given contact.

Syntax

dbo.ufnGetContactInformation ( ContactID )

Parameters

Variable | Data Type | Required | Output | Description
ContactID | int | Yes | No | Input parameter for the table value function ufnGetContactInformation. Enter a valid ContactID from the Person.Contact table.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
TABLE | No | No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.ContactType | Lookup table containing the types of contacts stored in Contact.
Purchasing.VendorContact | Cross-reference table mapping vendors and their employees.
Sales.Individual | Demographic data about customers that purchase Adventure Works products online.
Sales.StoreContact | Cross-reference table mapping stores and their employees.

Columns

Name | Data type | Nullable | Description
ContactID | int | No
FirstName | nvarchar(50) | No
LastName | nvarchar(50) | No
JobTitle | nvarchar(50) | No
ContactType | nvarchar(50) | No

Constraints

Name | Type | Columns | Description
PRIMARY KEY #1 | PRIMARY KEY | ContactID

Applies to

Functions | Multi-value table


SQL 2005 Adventure Works OLTP - Scalar

Scalar SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following functions return a scalar result.

dbo.ufnGetAccountingEndDate
dbo.ufnGetAccountingStartDate
dbo.ufnGetDocumentStatusText
dbo.ufnGetProductDealerPrice
dbo.ufnGetProductListPrice
dbo.ufnGetProductStandardCost
dbo.ufnGetPurchaseOrderStatusText
dbo.ufnGetSalesOrderStatusText
dbo.ufnGetStock
dbo.ufnLeadingZeros


dbo.ufnGetAccountingEndDate

Source code
Object type: User defined function

Scalar function used in the uSalesOrderHeader trigger to set the starting account date.

Syntax

dbo.ufnGetAccountingEndDate ( )

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
datetime | No | No | No | No | No

Calling triggers

Name | Description
Sales.uSalesOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.

Applies to

Functions | Scalar


dbo.ufnGetAccountingStartDate

Source code
Object type: User defined function

Scalar function used in the uSalesOrderHeader trigger to set the ending account date.

Syntax

dbo.ufnGetAccountingStartDate ( )

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
datetime | No | No | No | No | No

Calling triggers

Name | Description
Sales.uSalesOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.

Applies to

Functions | Scalar


dbo.ufnGetDocumentStatusText

Source code
Object type: User defined function

Scalar function returning the text representation of the Status column in the Document table.

Syntax

dbo.ufnGetDocumentStatusText ( Status )

Parameters

Variable | Data Type | Required | Output | Description
Status | tinyint | Yes | No | Input parameter for the scalar function ufnGetDocumentStatusText. Enter a valid integer.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
nvarchar(15) | No | No | No | No | No

Applies to

Functions | Scalar


dbo.ufnGetProductDealerPrice

Source code
Object type: User defined function

Scalar function returning the dealer price for a given product on a particular order date.

Syntax

dbo.ufnGetProductDealerPrice ( ProductID, OrderDate )

Parameters

Variable | Data Type | Required | Output | Description
ProductID | int | Yes | No | Input parameter for the scalar function ufnGetProductDealerPrice. Enter a valid ProductID from the Production.Product table.
OrderDate | datetime | Yes | No | Input parameter for the scalar function ufnGetProductDealerPrice. Enter a valid order date.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
money | No | No | No | No | No

Data Source Activity

Accesses | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductListPriceHistory | Changes in the list price of a product over time.

Applies to

Functions | Scalar


dbo.ufnGetProductListPrice

Source code
Object type: User defined function

Scalar function returning the list price for a given product on a particular order date.

Syntax

dbo.ufnGetProductListPrice ( ProductID, OrderDate )

Parameters

Variable | Data Type | Required | Output | Description
ProductID | int | Yes | No | Input parameter for the scalar function ufnGetProductListPrice. Enter a valid ProductID from the Production.Product table.
OrderDate | datetime | Yes | No | Input parameter for the scalar function ufnGetProductListPrice. Enter a valid order date.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
money | No | No | No | No | No

Data Source Activity

Accesses | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductListPriceHistory | Changes in the list price of a product over time.

Applies to

Functions | Scalar


dbo.ufnGetProductStandardCost

Source code
Object type: User defined function

Scalar function returning the standard cost for a given product on a particular order date.

Syntax

dbo.ufnGetProductStandardCost ( ProductID, OrderDate )

Parameters

Variable | Data Type | Required | Output | Description
ProductID | int | Yes | No | Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid ProductID from the Production.Product table.
OrderDate | datetime | Yes | No | Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid order date.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
money | No | No | No | No | No

Data Source Activity

Accesses | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCostHistory | Changes in the cost of a product over time.

Applies to

Functions | Scalar


dbo.ufnGetPurchaseOrderStatusText

Source code
Object type: User defined function

Scalar function returning the text representation of the Status column in the PurchaseOrderHeader table.

Syntax

dbo.ufnGetPurchaseOrderStatusText ( Status )

Parameters

Variable | Data Type | Required | Output | Description
Status | tinyint | Yes | No | Input parameter for the scalar function ufnGetPurchaseOrdertStatusText. Enter a valid integer.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
nvarchar(15) | No | No | No | No | No

Applies to

Functions | Scalar


dbo.ufnGetSalesOrderStatusText

Source code
Object type: User defined function

Scalar function returning the text representation of the Status column in the SalesOrderHeader table.

Syntax

dbo.ufnGetSalesOrderStatusText ( Status )

Parameters

Variable | Data Type | Required | Output | Description
Status | tinyint | Yes | No | Input parameter for the scalar function ufnGetSalesOrderStatusText. Enter a valid integer.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
nvarchar(15) | No | No | No | No | No

Applies to

Functions | Scalar


dbo.ufnGetStock

Source code
Object type: User defined function

Scalar function returning the quantity of inventory in LocationID 6 (Miscellaneous Storage)for a specified ProductID.

Syntax

dbo.ufnGetStock ( ProductID )

Parameters

Variable | Data Type | Required | Output | Description
ProductID | int | Yes | No | Input parameter for the scalar function ufnGetStock. Enter a valid ProductID from the Production.ProductInventory table.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
int | No | No | No | No | No

Data Source Activity

Accesses | Description
Production.ProductInventory | Product inventory information.

Applies to

Functions | Scalar


dbo.ufnLeadingZeros

Source code
Object type: User defined function

Scalar function used by the Sales.Customer table to help set the account number.

Syntax

dbo.ufnLeadingZeros ( Value )

Parameters

Variable | Data Type | Required | Output | Description
Value | int | Yes | No | Input parameter for the scalar function ufnLeadingZeros. Enter a valid integer.

Properties

Output data type | Transactional | Uses cursors | Executes procedures | Dynamic content | Encrypted
varchar(8) | No | No | No | No | No

Applies to

Functions | Scalar


SQL 2005 Adventure Works OLTP - Reporting Services reports

Reporting Services reports SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The following items are reports contained in Microsoft SQL Server Reporting Services reports.

Company Sales
Employee Sales Summary
Product Catalog
Product Line Sales
Sales Order Detail
Sales Reason Comparisons
Territory Sales Drilldown


SQL 2005 Adventure Works OLTP - Raw text

Raw text SQL 2005 Adventure Works OLTP

SQL 2005 Adventure Works OLTP

The reports listed all obtain their data from at least one dataset based on a raw SQL command.

Company Sales
Employee Sales Summary
Product Catalog
Product Line Sales
Sales Order Detail
Sales Reason Comparisons
Territory Sales Drilldown


Company Sales

Source code
Object type: Reporting Services report

Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Data Source Activity

Accesses | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.

Report Queries

Sales

Output Recordset

Column Description
ProdCat
SubCat
OrderYear
OrderQtr
Sales

Data source | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.

Applies to

Reporting Services reports | Command Text


Employee Sales Summary

Source code
Object type: Reporting Services report

Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.

Report Queries

EmpSalesYearOverYear

Parameters

Variable Description
ReportYear
ReportMonth
EmpID

Output Recordset

Column Description
Employee
OrderYear
OrderMonthNum
OrderMonth
Sales

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.

SalesEmps

Output Recordset

Column Description
EmployeeID
Employee

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Sales.SalesPerson | Sales representative current information.

EmpSalesMonth

Parameters

Variable Description
ReportYear
ReportMonth
EmpID

Output Recordset

Column Description
Employee
OrderYear
OrderMonthNum
OrderMonth
ProdCat
Sales

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.

EmpSalesDetail

Parameters

Variable Description
ReportYear
ReportMonth
EmpID

Output Recordset

Column Description
Employee
OrderMonthNum
SubCat
Sales
SalesOrderNumber
Product
OrderQty
UnitPrice
ProdCat

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.

Applies to

Reporting Services reports | Command Text


Product Catalog

Source code
Object type: Reporting Services report

Adventure Works full product catalog with pictures. This report illustrates the use of embedded images, database images, page breaks, page footers, tables, conditional formatting, and a document map.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Data Source Activity

Accesses | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductDescription | Product descriptions in several languages.
Production.ProductModel | Product model classification.
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.
Production.ProductPhoto | Product images.
Production.ProductProductPhoto | Cross-reference table mapping products and product photos.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.

Report Queries

ProductCatalog

Parameters

Variable Description
Language

Output Recordset

Column Description
ProdSubCat
ProdModel
ProdCat
Description
LargePhoto
ProdName
ProductNumber
Color
Size
Weight
StandardCost
Style
Class
ListPrice

Data source | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductDescription | Product descriptions in several languages.
Production.ProductModel | Product model classification.
Production.ProductModelProductDescriptionCulture | Cross-reference table mapping product descriptions and the language the description is written in.
Production.ProductPhoto | Product images.
Production.ProductProductPhoto | Cross-reference table mapping products and product photos.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.

Applies to

Reporting Services reports | Command Text


Product Line Sales

Source code
Object type: Reporting Services report

Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.Store | Customers (resellers) of Adventure Works products.

Report Queries

TopEmployees

Parameters

Variable Description
ProductCategory
ProductSubcategory
StartDate
EndDate

Output Recordset

Column Description
LastName
FirstName
EmployeeID
SaleAmount
FullName

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductCategory | High-level product categorization.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.

ProductCategories

Output Recordset

Column Description
ProductCategoryID
Name

Data source | Description
Production.ProductCategory | High-level product categorization.

TopCustomers

Parameters

Variable Description
ProductSubcategory
StartDate
EndDate
ProductCategory

Output Recordset

Column Description
StoreName
SaleAmount
ProductSubCategoryID
ProductCategoryID

Data source | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Production.ProductSubcategory | Product subcategories. See ProductCategory table.
Sales.Customer | Current customer information. Also see the Individual and Store tables.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.Store | Customers (resellers) of Adventure Works products.

ProductSubCategories

Parameters

Variable Description
ProductCategory

Output Recordset

Column Description
ProductSubCategoryID
ProductCategoryID
Name

Data source | Description
Production.ProductSubcategory | Product subcategories. See ProductCategory table.

Applies to

Reporting Services reports | Command Text


Sales Order Detail

Source code
Object type: Reporting Services report

Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Production.Product | Products sold or used in the manfacturing of sold products.
Purchasing.ShipMethod | Shipping company lookup table.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.
Sales.Store | Customers (resellers) of Adventure Works products.

Report Queries

SalesOrder

Parameters

Variable Description
SalesOrderNumber

Output Recordset

Column Description
SalesOrderNumber
Store
OrderDate
SalesFirstName
SalesLastName
SalesTitle
PurchaseOrderNumber
ShipMethod
BillAddress1
BillAddress2
BillCity
BillPostalCode
BillStateProvince
BillCountryRegion
ShipAddress1
ShipAddress2
ShipCity
ShipPostalCode
ShipStateProvince
ShipCountryRegion
CustPhone
CustFirstName
CustLastName

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Address | Street address information for customers, employees, and vendors.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Person.CountryRegion | Lookup table containing the ISO standard codes for countries and regions.
Person.StateProvince | State and province lookup table.
Purchasing.ShipMethod | Shipping company lookup table.
Sales.SalesOrderHeader | General sales order information.
Sales.Store | Customers (resellers) of Adventure Works products.

SalesOrderDetail

Parameters

Variable Description
SalesOrderNumber

Output Recordset

Column Description
SalesOrderDetailID
OrderQty
UnitPrice
UnitPriceDiscount
LineTotal
CarrierTrackingNumber
SalesOrderID
Name
ProductNumber

Data source | Description
Production.Product | Products sold or used in the manfacturing of sold products.
Sales.SalesOrderDetail | Individual products associated with a specific sales order. See SalesOrderHeader.
Sales.SalesOrderHeader | General sales order information.

Applies to

Reporting Services reports | Command Text


Sales Reason Comparisons

Source code
Object type: Reporting Services report

Shows sales reason comparison data from an Analysis Services cube. Also illustrates the use of a multivalued parameter. The Sales Reason Comparisons report requires SQL Server Analysis Services and the AdventureWorks Analysis Services database.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Report Queries

ProductData

Parameters

Variable Description
ProductCategory

Output Recordset

Column Description
Sales_Reason
Sales_Territory_Group
Internet_Order_Quantity
Internet_Sales_Amount
Internet_Total_Product_Cost

ProductList

Output Recordset

Column Description
Category
ParameterCaption
ParameterValue
ParameterLevel

Applies to

Reporting Services reports | Command Text


Territory Sales Drilldown

Source code
Object type: Reporting Services report

Adventure Works sales by territory. This report drills down through salesperson and order number with drillthrough to individual orders. This report illustrates the use of a table data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of drillthrough links and conditional formatting.

Properties

Transactional | Uses cursors | Executes procedures | Dynamic content
No | No | No | No

Data Source Activity

Accesses | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Report Queries

TerritorySales

Output Recordset

Column Description
Name
SalesPersonID
FirstName
LastName
SalesOrderNumber
TotalDue

Data source | Description
HumanResources.Employee | Employee information such as salary, department, and title.
Person.Contact | Names of each employee, customer contact, and vendor contact.
Sales.SalesOrderHeader | General sales order information.
Sales.SalesPerson | Sales representative current information.
Sales.SalesTerritory | Sales territory lookup table.

Applies to

Reporting Services reports | Command Text


dbo.uspGetBillOfMaterials - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.uspGetBillOfMaterials

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetBillOfMaterials]
@StartProductID [int],
@CheckDate [datetime]
AS
BEGIN
SET NOCOUNT ON;

-- Use recursive query to generate a multi-level Bill of Material (i.e. all level 1
-- components of a level 0 assembly, all level 2 components of a level 1 assembly)
-- The CheckDate eliminates any components that are no longer used in the product on this date.
WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], [RecursionLevel]) -- CTE name and columns
AS (
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get the initial list of components for the bike assembly
FROM [Production].[BillOfMaterials] b
INNER JOIN [Production].[Product] p
ON b.[ComponentID] = p.[ProductID]
WHERE b.[ProductAssemblyID] = @StartProductID
AND @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
UNION ALL
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [BOM_cte] cte
INNER JOIN [Production].[BillOfMaterials] b
ON b.[ProductAssemblyID] = cte.[ComponentID]
INNER JOIN [Production].[Product] p
ON b.[ComponentID] = p.[ProductID]
WHERE @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
)
-- Outer select from the CTE
SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], b.[ListPrice], b.[BOMLevel], b.[RecursionLevel]
FROM [BOM_cte] b
GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.[ListPrice]
ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID]
OPTION (MAXRECURSION 25)
END;

-- Stored Procedures
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stored procedure using a recursive query to return a multi-level bill of material for the specified ProductID.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetBillOfMaterials], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspGetBillOfMaterials. Enter a valid ProductID from the Production.Product table.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetBillOfMaterials], N'PARAMETER', '@StartProductID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspGetBillOfMaterials used to eliminate components not used after that date. Enter a valid date.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetBillOfMaterials], N'PARAMETER', '@CheckDate';


dbo.uspGetEmployeeManagers - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.uspGetEmployeeManagers

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetEmployeeManagers]
@EmployeeID [int]
AS
BEGIN
SET NOCOUNT ON;

-- Use recursive query to list out all Employees required for a particular Manager
WITH [EMP_cte]([EmployeeID], [ManagerID], [FirstName], [LastName], [Title], [RecursionLevel]) -- CTE name and columns
AS (
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], e.[Title], 0 -- Get the initial Employee
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
WHERE e.[EmployeeID] = @EmployeeID
UNION ALL
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], e.[Title], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [HumanResources].[Employee] e
INNER JOIN [EMP_cte]
ON e.[EmployeeID] = [EMP_cte].[ManagerID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
)
-- Join back to Employee to return the manager name
SELECT [EMP_cte].[RecursionLevel], [EMP_cte].[EmployeeID], [EMP_cte].[FirstName], [EMP_cte].[LastName],
[EMP_cte].[ManagerID], c.[FirstName] AS 'ManagerFirstName', c.[LastName] AS 'ManagerLastName' -- Outer select from the CTE
FROM [EMP_cte]
INNER JOIN [HumanResources].[Employee] e
ON [EMP_cte].[ManagerID] = e.[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
ORDER BY [RecursionLevel], [ManagerID], [EmployeeID]
OPTION (MAXRECURSION 25)
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stored procedure using a recursive query to return the direct and indirect managers of the specified employee.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetEmployeeManagers], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspGetEmployeeManagers. Enter a valid EmployeeID from the HumanResources.Employee table.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetEmployeeManagers], N'PARAMETER', '@EmployeeID';


dbo.uspGetManagerEmployees - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.uspGetManagerEmployees

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetManagerEmployees]
@ManagerID [int]
AS
BEGIN
SET NOCOUNT ON;

-- Use recursive query to list out all Employees required for a particular Manager
WITH [EMP_cte]([EmployeeID], [ManagerID], [FirstName], [LastName], [RecursionLevel]) -- CTE name and columns
AS (
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], 0 -- Get the initial list of Employees for Manager n
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
WHERE [ManagerID] = @ManagerID
UNION ALL
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [HumanResources].[Employee] e
INNER JOIN [EMP_cte]
ON e.[ManagerID] = [EMP_cte].[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
)
-- Join back to Employee to return the manager name
SELECT [EMP_cte].[RecursionLevel], [EMP_cte].[ManagerID], c.[FirstName] AS 'ManagerFirstName', c.[LastName] AS 'ManagerLastName',
[EMP_cte].[EmployeeID], [EMP_cte].[FirstName], [EMP_cte].[LastName] -- Outer select from the CTE
FROM [EMP_cte]
INNER JOIN [HumanResources].[Employee] e
ON [EMP_cte].[ManagerID] = e.[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
ORDER BY [RecursionLevel], [ManagerID], [EmployeeID]
OPTION (MAXRECURSION 25)
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stored procedure using a recursive query to return the direct and indirect employees of the specified manager.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetManagerEmployees], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspGetManagerEmployees. Enter a valid ManagerID from the HumanResources.Employee table.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetManagerEmployees], N'PARAMETER', '@ManagerID';


dbo.uspGetWhereUsedProductID - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.uspGetWhereUsedProductID

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetWhereUsedProductID]
@StartProductID [int],
@CheckDate [datetime]
AS
BEGIN
SET NOCOUNT ON;

--Use recursive query to generate a multi-level Bill of Material (i.e. all level 1 components of a level 0 assembly, all level 2 components of a level 1 assembly)
WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], [RecursionLevel]) -- CTE name and columns
AS (
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get the initial list of components for the bike assembly
FROM [Production].[BillOfMaterials] b
INNER JOIN [Production].[Product] p
ON b.[ProductAssemblyID] = p.[ProductID]
WHERE b.[ComponentID] = @StartProductID
AND @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
UNION ALL
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [BOM_cte] cte
INNER JOIN [Production].[BillOfMaterials] b
ON cte.[ProductAssemblyID] = b.[ComponentID]
INNER JOIN [Production].[Product] p
ON b.[ProductAssemblyID] = p.[ProductID]
WHERE @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
)
-- Outer select from the CTE
SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], b.[ListPrice], b.[BOMLevel], b.[RecursionLevel]
FROM [BOM_cte] b
GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.[ListPrice]
ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID]
OPTION (MAXRECURSION 25)
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stored procedure using a recursive query to return all components or assemblies that directly or indirectly use the specified ProductID.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetWhereUsedProductID], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspGetWhereUsedProductID. Enter a valid ProductID from the Production.Product table.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetWhereUsedProductID], N'PARAMETER', '@StartProductID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspGetWhereUsedProductID used to eliminate components not used after that date. Enter a valid date.', N'SCHEMA', [dbo], N'PROCEDURE', [uspGetWhereUsedProductID], N'PARAMETER', '@CheckDate';


HumanResources.uspUpdateEmployeeHireInfo - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uspUpdateEmployeeHireInfo

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeHireInfo]
@EmployeeID [int],
@Title [nvarchar](50),
@HireDate [datetime],
@RateChangeDate [datetime],
@Rate [money],
@PayFrequency [tinyint],
@CurrentFlag [dbo].[Flag]
WITH EXECUTE AS CALLER
AS
BEGIN
SET NOCOUNT ON;

BEGIN TRANSACTION

UPDATE [HumanResources].[Employee]
SET [Title] = @Title
,[HireDate] = @HireDate
,[CurrentFlag] = @CurrentFlag
WHERE [EmployeeID] = @EmployeeID;

-- Test the error value.
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

INSERT INTO [HumanResources].[EmployeePayHistory]
([EmployeeID]
,[RateChangeDate]
,[Rate]
,[PayFrequency])
VALUES (@EmployeeID, @RateChangeDate, @Rate, @PayFrequency);

-- Test the error value.
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

-- OK, so commit
COMMIT TRANSACTION

RETURN;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Updates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid EmployeeID from the Employee table.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@EmployeeID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a title for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@Title';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a hire date for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@HireDate';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the date the rate changed for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@RateChangeDate';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the new rate for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@Rate';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the pay frequency for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@PayFrequency';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the current flag for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeHireInfo], N'PARAMETER', '@CurrentFlag';


HumanResources.uspUpdateEmployeeLogin - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uspUpdateEmployeeLogin

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeLogin]
@EmployeeID [int],
@ManagerID [int],
@LoginID [nvarchar](256),
@Title [nvarchar](50),
@HireDate [datetime],
@CurrentFlag [dbo].[Flag]
WITH EXECUTE AS CALLER
AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[Employee]
SET [ManagerID] = @ManagerID
,[LoginID] = @LoginID
,[Title] = @Title
,[HireDate] = @HireDate
,[CurrentFlag] = @CurrentFlag
WHERE [EmployeeID] = @EmployeeID;

-- Test the error value.
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

RETURN;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Updates the Employee table with the values specified in the input parameters for the given EmployeeID.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeLogin. Enter a valid EmployeeID from the Employee table.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], N'PARAMETER', '@EmployeeID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid ManagerID for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], N'PARAMETER', '@ManagerID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid login for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], N'PARAMETER', '@LoginID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a title for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], N'PARAMETER', '@Title';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a hire date for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], N'PARAMETER', '@HireDate';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the current flag for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeeLogin], N'PARAMETER', '@CurrentFlag';


HumanResources.uspUpdateEmployeePersonalInfo - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uspUpdateEmployeePersonalInfo

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [HumanResources].[uspUpdateEmployeePersonalInfo]
@EmployeeID [int],
@NationalIDNumber [nvarchar](15),
@BirthDate [datetime],
@MaritalStatus [nchar](1),
@Gender [nchar](1)
WITH EXECUTE AS CALLER
AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[Employee]
SET [NationalIDNumber] = @NationalIDNumber
,[BirthDate] = @BirthDate
,[MaritalStatus] = @MaritalStatus
,[Gender] = @Gender
WHERE [EmployeeID] = @EmployeeID;

-- Test the error value.
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

RETURN;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Updates the Employee table with the values specified in the input parameters for the given EmployeeID.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeePersonalInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeePersonalInfo. Enter a valid EmployeeID from the HumanResources.Employee table.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeePersonalInfo], N'PARAMETER', '@EmployeeID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a national ID for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeePersonalInfo], N'PARAMETER', '@NationalIDNumber';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a birth date for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeePersonalInfo], N'PARAMETER', '@BirthDate';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a marital status for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeePersonalInfo], N'PARAMETER', '@MaritalStatus';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a gender for the employee.', N'SCHEMA', [HumanResources], N'PROCEDURE', [uspUpdateEmployeePersonalInfo], N'PARAMETER', '@Gender';


dbo.DatabaseLog - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.DatabaseLog

Summary listing Bookmark Print Locate in contents

-- Create table to store database object creation messages
-- *** WARNING: THIS TABLE IS INTENTIONALLY A HEAP - DO NOT ADD A PRIMARY KEY ***
CREATE TABLE [dbo].[DatabaseLog](
[DatabaseLogID] [int] IDENTITY (1, 1) NOT NULL,
[PostTime] [datetime] NOT NULL,
[DatabaseUser] [sysname] NOT NULL,
[Event] [sysname] NOT NULL,
[Schema] [sysname] NULL,
[Object] [sysname] NULL,
[TSQL] [nvarchar](max) NOT NULL,
[XmlEvent] [xml] NOT NULL
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for DatabaseLog records.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [DatabaseLogID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The date and time the DDL change occurred.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [PostTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The user who implemented the DDL change.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [DatabaseUser];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The type of DDL statement that was executed.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [Event];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The schema to which the changed object belongs.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [Schema];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The object that was changed by the DDL statment.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [Object];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The exact Transact-SQL statement that was executed.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [TSQL];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The raw XML data generated by database trigger.', N'SCHEMA', [dbo], N'TABLE', [DatabaseLog], N'COLUMN', [XmlEvent];


Person.Address - Source code

Source code SQL 2005 Adventure Works OLTP

Person.Address

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Person].[Address](
[AddressID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
[AddressLine1] [nvarchar](60) NOT NULL,
[AddressLine2] [nvarchar](60) NULL,
[City] [nvarchar](30) NOT NULL,
[StateProvinceID] [int] NOT NULL,
[PostalCode] [nvarchar](15) NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Address_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Address_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

SET QUOTED_IDENTIFIER ON;

ALTER TABLE [Person].[Address] WITH CHECK ADD
CONSTRAINT [PK_Address_AddressID] PRIMARY KEY CLUSTERED
(
[AddressID]
) ON [PRIMARY];

ALTER TABLE [Person].[Address] ADD
CONSTRAINT [FK_Address_StateProvince_StateProvinceID] FOREIGN KEY
(
[StateProvinceID]
) REFERENCES [Person].[StateProvince](
[StateProvinceID]
);

-- Tables and Columns
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Street address information for customers, employees, and vendors.', N'SCHEMA', [Person], N'TABLE', [Address], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Address records.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'First street address line.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [AddressLine1];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Second street address line.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [AddressLine2];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Name of the city.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [City];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique identification number for the state or province. Foreign key to StateProvince table.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Postal code for the street address.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [PostalCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Person], N'TABLE', [Address], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

-- Indexes
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [AK_Address_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [PK_Address_AddressID];

-- Constraints - PK, FK, DF, CK
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Person], N'TABLE', [Address], N'CONSTRAINT', [PK_Address_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing StateProvince.StateProvinceID.', N'SCHEMA', [Person], N'TABLE', [Address], N'CONSTRAINT', [FK_Address_StateProvince_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Person], N'TABLE', [Address], N'CONSTRAINT', [DF_Address_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Person], N'TABLE', [Address], N'CONSTRAINT', [DF_Address_rowguid]; -- (NEWID())


Person.AddressType - Source code

Source code SQL 2005 Adventure Works OLTP

Person.AddressType

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Person].[AddressType](
[AddressTypeID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_AddressType_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_AddressType_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Person].[AddressType] WITH CHECK ADD
CONSTRAINT [PK_AddressType_AddressTypeID] PRIMARY KEY CLUSTERED
(
[AddressTypeID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Types of addresses stored in the Address table. ', N'SCHEMA', [Person], N'TABLE', [AddressType], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for AddressType records.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'COLUMN', [AddressTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Address type description. For example, Billing, Home, or Shipping.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [AK_AddressType_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [AK_AddressType_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [PK_AddressType_AddressTypeID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Person], N'TABLE', [AddressType], N'CONSTRAINT', [PK_AddressType_AddressTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Person], N'TABLE', [AddressType], N'CONSTRAINT', [DF_AddressType_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Person], N'TABLE', [AddressType], N'CONSTRAINT', [DF_AddressType_rowguid]; -- (NEWID())


dbo.AWBuildVersion - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.AWBuildVersion

Summary listing Bookmark Print Locate in contents

CREATE TABLE [dbo].[AWBuildVersion](
[SystemInformationID] [tinyint] IDENTITY (1, 1) NOT NULL,
[Database Version] [nvarchar](25) NOT NULL,
[VersionDate] [datetime] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_AWBuildVersion_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [dbo].[AWBuildVersion] WITH CHECK ADD
CONSTRAINT [PK_AWBuildVersion_SystemInformationID] PRIMARY KEY CLUSTERED
(
[SystemInformationID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Current version number of the AdventureWorks sample database. ', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for AWBuildVersion records.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'COLUMN', [SystemInformationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Version number of the database in 9.yy.mm.dd.00 format.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'COLUMN', [Database Version];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'COLUMN', [VersionDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'INDEX', [PK_AWBuildVersion_SystemInformationID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'CONSTRAINT', [PK_AWBuildVersion_SystemInformationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'CONSTRAINT', [DF_AWBuildVersion_ModifiedDate]; -- (GETDATE())


Production.BillOfMaterials - Source code

Source code SQL 2005 Adventure Works OLTP

Production.BillOfMaterials

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[BillOfMaterials](
[BillOfMaterialsID] [int] IDENTITY (1, 1) NOT NULL,
[ProductAssemblyID] [int] NULL,
[ComponentID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL CONSTRAINT [DF_BillOfMaterials_StartDate] DEFAULT (GETDATE()),
[EndDate] [datetime] NULL,
[UnitMeasureCode] [nchar](3) NOT NULL,
[BOMLevel] [smallint] NOT NULL,
[PerAssemblyQty] [decimal](8, 2) NOT NULL CONSTRAINT [DF_BillOfMaterials_PerAssemblyQty] DEFAULT (1.00),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_BillOfMaterials_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_BillOfMaterials_EndDate] CHECK (([EndDate] > [StartDate]) OR ([EndDate] IS NULL)),
CONSTRAINT [CK_BillOfMaterials_ProductAssemblyID] CHECK ([ProductAssemblyID] <> [ComponentID]),
CONSTRAINT [CK_BillOfMaterials_BOMLevel] CHECK ((([ProductAssemblyID] IS NULL)
AND ([BOMLevel] = 0) AND ([PerAssemblyQty] = 1.00))
OR (([ProductAssemblyID] IS NOT NULL) AND ([BOMLevel] >= 1))),
CONSTRAINT [CK_BillOfMaterials_PerAssemblyQty] CHECK ([PerAssemblyQty] >= 1.00)
) ON [PRIMARY];

ALTER TABLE [Production].[BillOfMaterials] WITH CHECK ADD
CONSTRAINT [PK_BillOfMaterials_BillOfMaterialsID] PRIMARY KEY NONCLUSTERED
(
[BillOfMaterialsID]
) ON [PRIMARY];

ALTER TABLE [Production].[BillOfMaterials] ADD
CONSTRAINT [FK_BillOfMaterials_Product_ProductAssemblyID] FOREIGN KEY
(
[ProductAssemblyID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_BillOfMaterials_Product_ComponentID] FOREIGN KEY
(
[ComponentID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_BillOfMaterials_UnitMeasure_UnitMeasureCode] FOREIGN KEY
(
[UnitMeasureCode]
) REFERENCES [Production].[UnitMeasure](
[UnitMeasureCode]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for BillOfMaterials records.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [BillOfMaterialsID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Parent product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [ProductAssemblyID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Component identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [ComponentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the component started being used in the assembly item.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the component stopped being used in the assembly item.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Standard code identifying the unit of measure for the quantity.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Indicates the depth the component is from its parent (AssemblyID).', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [BOMLevel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity of the component needed to create the assembly.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [PerAssemblyQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [IX_BillOfMaterials_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [PK_BillOfMaterials_BillOfMaterialsID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [PK_BillOfMaterials_BillOfMaterialsID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ComponentID.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [FK_BillOfMaterials_Product_ComponentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductAssemblyID.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [FK_BillOfMaterials_Product_ProductAssemblyID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing UnitMeasure.UnitMeasureCode.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [FK_BillOfMaterials_UnitMeasure_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1.0', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [DF_BillOfMaterials_PerAssemblyQty]; -- ((1.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [DF_BillOfMaterials_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [DF_BillOfMaterials_StartDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [PerAssemblyQty]>=(1.00)', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [CK_BillOfMaterials_PerAssemblyQty]; -- ([PerAssemblyQty]>=(1.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ProductAssemblyID]<>[ComponentID]', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [CK_BillOfMaterials_ProductAssemblyID]; -- ([ProductAssemblyID]<>[ComponentID])
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint EndDate]>[StartDate] OR [EndDate] IS NULL', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [CK_BillOfMaterials_EndDate]; -- ([EndDate]>[StartDate] OR [EndDate] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ProductAssemblyID] IS NULL AND [BOMLevel] = (0) AND [PerAssemblyQty] = (1) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel] >= (1)', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'CONSTRAINT', [CK_BillOfMaterials_BOMLevel]; -- ([ProductAssemblyID] IS NULL AND [BOMLevel]=(0) AND [PerAssemblyQty]=(1.00) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel]>=(1))


Person.Contact - Source code

Source code SQL 2005 Adventure Works OLTP

Person.Contact

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Person].[Contact](
[ContactID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
[NameStyle] [NameStyle] NOT NULL CONSTRAINT [DF_Contact_NameStyle] DEFAULT (0),
[Title] [nvarchar](8) NULL,
[FirstName] [Name] NOT NULL,
[MiddleName] [Name] NULL,
[LastName] [Name] NOT NULL,
[Suffix] [nvarchar](10) NULL,
[EmailAddress] [nvarchar](50) NULL,
[EmailPromotion] [int] NOT NULL CONSTRAINT [DF_Contact_EmailPromotion] DEFAULT (0),
[Phone] [Phone] NULL,
[PasswordHash] [varchar](40) NOT NULL,
[PasswordSalt] [varchar](10) NOT NULL,
[AdditionalContactInfo] [XML]([Person].[AdditionalContactInfoSchemaCollection]) NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Contact_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Contact_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Contact_EmailPromotion] CHECK ([EmailPromotion] BETWEEN 0 AND 2)
) ON [PRIMARY];

ALTER TABLE [Person].[Contact] WITH CHECK ADD
CONSTRAINT [PK_Contact_ContactID] PRIMARY KEY CLUSTERED
(
[ContactID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Names of each employee, customer contact, and vendor contact.', N'SCHEMA', [Person], N'TABLE', [Contact], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Contact records.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [NameStyle];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'A courtesy title. For example, Mr. or Ms.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [Title];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'First name of the person.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [FirstName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Middle name or middle initial of the person.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [MiddleName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Last name of the person.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [LastName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Surname suffix. For example, Sr. or Jr.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [Suffix];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'E-mail address for the person.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [EmailAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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. ', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [EmailPromotion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Phone number associated with the person.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [Phone];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Password for the e-mail account.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [PasswordHash];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Random value concatenated with the password string before the password is hashed.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [PasswordSalt];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Additional contact information about the person stored in xml format. ', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [AdditionalContactInfo];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Person], N'TABLE', [Contact], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [IX_Contact_EmailAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [AK_Contact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PK_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PXML_Contact_AddContact];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Person], N'TABLE', [Contact], N'CONSTRAINT', [PK_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Person], N'TABLE', [Contact], N'CONSTRAINT', [DF_Contact_EmailPromotion]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Person], N'TABLE', [Contact], N'CONSTRAINT', [DF_Contact_NameStyle]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Person], N'TABLE', [Contact], N'CONSTRAINT', [DF_Contact_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Person], N'TABLE', [Contact], N'CONSTRAINT', [DF_Contact_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EmailPromotion]>=(0) AND [EmailPromotion]<=(2)', N'SCHEMA', [Person], N'TABLE', [Contact], N'CONSTRAINT', [CK_Contact_EmailPromotion]; -- ([EmailPromotion]>=(0) AND [EmailPromotion]<=(2))


Sales.ContactCreditCard - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.ContactCreditCard

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[ContactCreditCard](
[ContactID] [int] NOT NULL,
[CreditCardID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ContactCreditCard_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[ContactCreditCard] WITH CHECK ADD
CONSTRAINT [PK_ContactCreditCard_ContactID_CreditCardID] PRIMARY KEY CLUSTERED
(
[ContactID],
[CreditCardID]
) ON [PRIMARY];

ALTER TABLE [Sales].[ContactCreditCard] ADD
CONSTRAINT [FK_ContactCreditCard_Contact_ContactID] FOREIGN KEY
(
[ContactID]
) REFERENCES [Person].[Contact](
[ContactID]
),
CONSTRAINT [FK_ContactCreditCard_CreditCard_CreditCardID] FOREIGN KEY
(
[CreditCardID]
) REFERENCES [Sales].[CreditCard](
[CreditCardID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table. ', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer identification number. Foreign key to Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Credit card identification number. Foreign key to CreditCard.CreditCardID.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'COLUMN', [CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'INDEX', [PK_ContactCreditCard_ContactID_CreditCardID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'CONSTRAINT', [PK_ContactCreditCard_ContactID_CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'CONSTRAINT', [FK_ContactCreditCard_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing CreditCard.CreditCardID.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'CONSTRAINT', [FK_ContactCreditCard_CreditCard_CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'CONSTRAINT', [DF_ContactCreditCard_ModifiedDate]; -- (GETDATE())


Person.ContactType - Source code

Source code SQL 2005 Adventure Works OLTP

Person.ContactType

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Person].[ContactType](
[ContactTypeID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ContactType_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Person].[ContactType] WITH CHECK ADD
CONSTRAINT [PK_ContactType_ContactTypeID] PRIMARY KEY CLUSTERED
(
[ContactTypeID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Lookup table containing the types of contacts stored in Contact.', N'SCHEMA', [Person], N'TABLE', [ContactType], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ContactType records.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'COLUMN', [ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Contact type description.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'INDEX', [AK_ContactType_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'INDEX', [PK_ContactType_ContactTypeID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Person], N'TABLE', [ContactType], N'CONSTRAINT', [PK_ContactType_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Person], N'TABLE', [ContactType], N'CONSTRAINT', [DF_ContactType_ModifiedDate]; -- (GETDATE())


Sales.CountryRegionCurrency - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.CountryRegionCurrency

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[CountryRegionCurrency](
[CountryRegionCode] [nvarchar](3) NOT NULL,
[CurrencyCode] [nchar](3) NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_CountryRegionCurrency_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[CountryRegionCurrency] WITH CHECK ADD
CONSTRAINT [PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode] PRIMARY KEY CLUSTERED
(
[CountryRegionCode],
[CurrencyCode]
) ON [PRIMARY];

ALTER TABLE [Sales].[CountryRegionCurrency] ADD
CONSTRAINT [FK_CountryRegionCurrency_CountryRegion_CountryRegionCode] FOREIGN KEY
(
[CountryRegionCode]
) REFERENCES [Person].[CountryRegion](
[CountryRegionCode]
),
CONSTRAINT [FK_CountryRegionCurrency_Currency_CurrencyCode] FOREIGN KEY
(
[CurrencyCode]
) REFERENCES [Sales].[Currency](
[CurrencyCode]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping ISO currency codes to a country or region.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'COLUMN', [CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ISO standard currency code. Foreign key to Currency.CurrencyCode.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'COLUMN', [CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'INDEX', [IX_CountryRegionCurrency_CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'INDEX', [PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'CONSTRAINT', [PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing CountryRegion.CountryRegionCode.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'CONSTRAINT', [FK_CountryRegionCurrency_CountryRegion_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Currency.CurrencyCode.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'CONSTRAINT', [FK_CountryRegionCurrency_Currency_CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'CONSTRAINT', [DF_CountryRegionCurrency_ModifiedDate]; -- (GETDATE())


Person.CountryRegion - Source code

Source code SQL 2005 Adventure Works OLTP

Person.CountryRegion

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Person].[CountryRegion](
[CountryRegionCode] [nvarchar](3) NOT NULL,
[Name] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_CountryRegion_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Person].[CountryRegion] WITH CHECK ADD
CONSTRAINT [PK_CountryRegion_CountryRegionCode] PRIMARY KEY CLUSTERED
(
[CountryRegionCode]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Lookup table containing the ISO standard codes for countries and regions.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ISO standard code for countries and regions.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'COLUMN', [CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Country or region name.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'INDEX', [AK_CountryRegion_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'INDEX', [PK_CountryRegion_CountryRegionCode];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'CONSTRAINT', [PK_CountryRegion_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'CONSTRAINT', [DF_CountryRegion_ModifiedDate]; -- (GETDATE())


Sales.CreditCard - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.CreditCard

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[CreditCard](
[CreditCardID] [int] IDENTITY (1, 1) NOT NULL,
[CardType] [nvarchar](50) NOT NULL,
[CardNumber] [nvarchar](25) NOT NULL,
[ExpMonth] [tinyint] NOT NULL,
[ExpYear] [smallint] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_CreditCard_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[CreditCard] WITH CHECK ADD
CONSTRAINT [PK_CreditCard_CreditCardID] PRIMARY KEY CLUSTERED
(
[CreditCardID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer credit card information.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for CreditCard records.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'COLUMN', [CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Credit card name.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'COLUMN', [CardType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Credit card number.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'COLUMN', [CardNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Credit card expiration month.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'COLUMN', [ExpMonth];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Credit card expiration year.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'COLUMN', [ExpYear];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'INDEX', [AK_CreditCard_CardNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'INDEX', [PK_CreditCard_CreditCardID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'CONSTRAINT', [PK_CreditCard_CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'CONSTRAINT', [DF_CreditCard_ModifiedDate]; -- (GETDATE())


Production.Culture - Source code

Source code SQL 2005 Adventure Works OLTP

Production.Culture

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[Culture](
[CultureID] [nchar](6) NOT NULL,
[Name] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Culture_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[Culture] WITH CHECK ADD
CONSTRAINT [PK_Culture_CultureID] PRIMARY KEY CLUSTERED
(
[CultureID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Lookup table containing the languages in which some AdventureWorks data is stored.', N'SCHEMA', [Production], N'TABLE', [Culture], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Culture records.', N'SCHEMA', [Production], N'TABLE', [Culture], N'COLUMN', [CultureID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Culture description.', N'SCHEMA', [Production], N'TABLE', [Culture], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [Culture], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Culture], N'INDEX', [AK_Culture_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Culture], N'INDEX', [PK_Culture_CultureID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [Culture], N'CONSTRAINT', [PK_Culture_CultureID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [Culture], N'CONSTRAINT', [DF_Culture_ModifiedDate]; -- (GETDATE())


Sales.Currency - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.Currency

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[Currency](
[CurrencyCode] [nchar](3) NOT NULL,
[Name] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Currency_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[Currency] WITH CHECK ADD
CONSTRAINT [PK_Currency_CurrencyCode] PRIMARY KEY CLUSTERED
(
[CurrencyCode]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Lookup table containing standard ISO currencies.', N'SCHEMA', [Sales], N'TABLE', [Currency], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The ISO code for the Currency.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'COLUMN', [CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Currency name.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'INDEX', [AK_Currency_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'INDEX', [PK_Currency_CurrencyCode];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [Currency], N'CONSTRAINT', [PK_Currency_CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [Currency], N'CONSTRAINT', [DF_Currency_ModifiedDate]; -- (GETDATE())


Sales.CurrencyRate - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.CurrencyRate

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[CurrencyRate](
[CurrencyRateID] [int] IDENTITY (1, 1) NOT NULL,
[CurrencyRateDate] [datetime] NOT NULL,
[FromCurrencyCode] [nchar](3) NOT NULL,
[ToCurrencyCode] [nchar](3) NOT NULL,
[AverageRate] [money] NOT NULL,
[EndOfDayRate] [money] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_CurrencyRate_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[CurrencyRate] WITH CHECK ADD
CONSTRAINT [PK_CurrencyRate_CurrencyRateID] PRIMARY KEY CLUSTERED
(
[CurrencyRateID]
) ON [PRIMARY];

ALTER TABLE [Sales].[CurrencyRate] ADD
CONSTRAINT [FK_CurrencyRate_Currency_FromCurrencyCode] FOREIGN KEY
(
[FromCurrencyCode]
) REFERENCES [Sales].[Currency](
[CurrencyCode]
),
CONSTRAINT [FK_CurrencyRate_Currency_ToCurrencyCode] FOREIGN KEY
(
[ToCurrencyCode]
) REFERENCES [Sales].[Currency](
[CurrencyCode]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Currency exchange rates.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for CurrencyRate records.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [CurrencyRateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the exchange rate was obtained.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [CurrencyRateDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Exchange rate was converted from this currency code.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [FromCurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Exchange rate was converted to this currency code.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [ToCurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Average exchange rate for the day.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [AverageRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Final exchange rate for the day.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [EndOfDayRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'INDEX', [AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'INDEX', [PK_CurrencyRate_CurrencyRateID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'CONSTRAINT', [PK_CurrencyRate_CurrencyRateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Currency.FromCurrencyCode.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'CONSTRAINT', [FK_CurrencyRate_Currency_FromCurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Currency.ToCurrencyCode.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'CONSTRAINT', [FK_CurrencyRate_Currency_ToCurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'CONSTRAINT', [DF_CurrencyRate_ModifiedDate]; -- (GETDATE())


Sales.Customer - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.Customer

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[Customer](
[CustomerID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
[TerritoryID] [int] NULL,
[AccountNumber] AS ISNULL('AW' + [dbo].[ufnLeadingZeros](CustomerID), ''),
[CustomerType] [nchar](1) NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Customer_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Customer_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Customer_CustomerType] CHECK (UPPER([CustomerType]) IN ('S', 'I'))
) ON [PRIMARY];

ALTER TABLE [Sales].[Customer] WITH CHECK ADD
CONSTRAINT [PK_Customer_CustomerID] PRIMARY KEY CLUSTERED
(
[CustomerID]
) ON [PRIMARY];

ALTER TABLE [Sales].[Customer] ADD
CONSTRAINT [FK_Customer_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [Sales].[SalesTerritory](
[TerritoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Current customer information. Also see the Individual and Store tables.', N'SCHEMA', [Sales], N'TABLE', [Customer], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Customer records.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'COLUMN', [CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'COLUMN', [TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique number identifying the customer assigned by the accounting system.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'COLUMN', [AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer type: I = Individual, S = Store', N'SCHEMA', [Sales], N'TABLE', [Customer], N'COLUMN', [CustomerType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [IX_Customer_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [PK_Customer_CustomerID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [Customer], N'CONSTRAINT', [PK_Customer_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesTerritory.TerritoryID.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'CONSTRAINT', [FK_Customer_SalesTerritory_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [Customer], N'CONSTRAINT', [DF_Customer_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [Customer], N'CONSTRAINT', [DF_Customer_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [CustomerType]=''I'' OR [CustomerType]=''i'' OR [CustomerType]=''S'' OR [CustomerType]=''s''', N'SCHEMA', [Sales], N'TABLE', [Customer], N'CONSTRAINT', [CK_Customer_CustomerType]; -- (UPPER([CustomerType])='I' OR UPPER([CustomerType])='S')


Sales.CustomerAddress - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.CustomerAddress

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[CustomerAddress](
[CustomerID] [int] NOT NULL,
[AddressID] [int] NOT NULL,
[AddressTypeID] [int] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_CustomerAddress_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_CustomerAddress_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[CustomerAddress] WITH CHECK ADD
CONSTRAINT [PK_CustomerAddress_CustomerID_AddressID] PRIMARY KEY CLUSTERED
(
[CustomerID],
[AddressID]
) ON [PRIMARY];

ALTER TABLE [Sales].[CustomerAddress] ADD
CONSTRAINT [FK_CustomerAddress_Address_AddressID] FOREIGN KEY
(
[AddressID]
) REFERENCES [Person].[Address](
[AddressID]
),
CONSTRAINT [FK_CustomerAddress_AddressType_AddressTypeID] FOREIGN KEY
(
[AddressTypeID]
) REFERENCES [Person].[AddressType](
[AddressTypeID]
),
CONSTRAINT [FK_CustomerAddress_Customer_CustomerID] FOREIGN KEY
(
[CustomerID]
) REFERENCES [Sales].[Customer](
[CustomerID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping customers to their address(es).', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'COLUMN', [CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Address.AddressID.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'COLUMN', [AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Address type. Foreign key to AddressType.AddressTypeID.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'COLUMN', [AddressTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'INDEX', [AK_CustomerAddress_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'INDEX', [PK_CustomerAddress_CustomerID_AddressID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'CONSTRAINT', [PK_CustomerAddress_CustomerID_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Address.AddressID.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'CONSTRAINT', [FK_CustomerAddress_Address_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing AddressType.AddressTypeID.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'CONSTRAINT', [FK_CustomerAddress_AddressType_AddressTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'CONSTRAINT', [FK_CustomerAddress_Customer_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'CONSTRAINT', [DF_CustomerAddress_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'CONSTRAINT', [DF_CustomerAddress_rowguid]; -- (NEWID())


HumanResources.Department - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.Department

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[Department](
[DepartmentID] [smallint] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[GroupName] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Department_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [HumanResources].[Department] WITH CHECK ADD
CONSTRAINT [PK_Department_DepartmentID] PRIMARY KEY CLUSTERED
(
[DepartmentID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Lookup table containing the departments within the Adventure Works Cycles company.', N'SCHEMA', [HumanResources], N'TABLE', [Department], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Department records.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'COLUMN', [DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Name of the department.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Name of the group to which the department belongs.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'COLUMN', [GroupName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'INDEX', [AK_Department_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'INDEX', [PK_Department_DepartmentID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'CONSTRAINT', [PK_Department_DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'CONSTRAINT', [DF_Department_ModifiedDate]; -- (GETDATE())


Production.Document - Source code

Source code SQL 2005 Adventure Works OLTP

Production.Document

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[Document](
[DocumentID] [int] IDENTITY (1, 1) NOT NULL,
[Title] [nvarchar](50) NOT NULL,
[FileName] [nvarchar](400) NOT NULL,
[FileExtension] nvarchar(8) NOT NULL,
[Revision] [nchar](5) NOT NULL,
[ChangeNumber] [int] NOT NULL CONSTRAINT [DF_Document_ChangeNumber] DEFAULT (0),
[Status] [tinyint] NOT NULL,
[DocumentSummary] [nvarchar](max) NULL,
[Document] [varbinary](max) NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Document_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Document_Status] CHECK ([Status] BETWEEN 1 AND 3)
) ON [PRIMARY];

ALTER TABLE [Production].[Document] WITH CHECK ADD
CONSTRAINT [PK_Document_DocumentID] PRIMARY KEY CLUSTERED
(
[DocumentID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product maintenance documents.', N'SCHEMA', [Production], N'TABLE', [Document], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Document records.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [DocumentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Title of the document.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [Title];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Directory path and file name of the document', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [FileName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'File extension indicating the document type. For example, .doc or .txt.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [FileExtension];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Revision number of the document. ', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [Revision];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Engineering change approval number.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [ChangeNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'1 = Pending approval, 2 = Approved, 3 = Obsolete', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [Status];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Document abstract.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [DocumentSummary];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Complete document.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [Document];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [Document], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Document], N'INDEX', [AK_Document_FileName_Revision];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Document], N'INDEX', [PK_Document_DocumentID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [Document], N'CONSTRAINT', [PK_Document_DocumentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Production], N'TABLE', [Document], N'CONSTRAINT', [DF_Document_ChangeNumber]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [Document], N'CONSTRAINT', [DF_Document_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Status] BETWEEN (1) AND (3)', N'SCHEMA', [Production], N'TABLE', [Document], N'CONSTRAINT', [CK_Document_Status]; -- ([Status]>=(1) AND [Status]<=(3))


HumanResources.Employee - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.Employee

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[Employee](
[EmployeeID] [int] IDENTITY (1, 1) NOT NULL,
[NationalIDNumber] [nvarchar](15) NOT NULL,
[ContactID] [int] NOT NULL,
[LoginID] [nvarchar](256) NOT NULL,
[ManagerID] [int] NULL,
[Title] [nvarchar](50) NOT NULL,
[BirthDate] [datetime] NOT NULL,
[MaritalStatus] [nchar](1) NOT NULL,
[Gender] [nchar](1) NOT NULL,
[HireDate] [datetime] NOT NULL,
[SalariedFlag] [Flag] NOT NULL CONSTRAINT [DF_Employee_SalariedFlag] DEFAULT (1),
[VacationHours] [smallint] NOT NULL CONSTRAINT [DF_Employee_VacationHours] DEFAULT (0),
[SickLeaveHours] [smallint] NOT NULL CONSTRAINT [DF_Employee_SickLeaveHours] DEFAULT (0),
[CurrentFlag] [Flag] NOT NULL CONSTRAINT [DF_Employee_CurrentFlag] DEFAULT (1),
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Employee_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Employee_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Employee_BirthDate] CHECK ([BirthDate] BETWEEN '1930-01-01' AND DATEADD(YEAR, -18, GETDATE())),
CONSTRAINT [CK_Employee_MaritalStatus] CHECK (UPPER([MaritalStatus]) IN ('M', 'S')), -- Married or Single
CONSTRAINT [CK_Employee_HireDate] CHECK ([HireDate] BETWEEN '1996-07-01' AND DATEADD(DAY, 1, GETDATE())),
CONSTRAINT [CK_Employee_Gender] CHECK (UPPER([Gender]) IN ('M', 'F')), -- Male or Female
CONSTRAINT [CK_Employee_VacationHours] CHECK ([VacationHours] BETWEEN -40 AND 240),
CONSTRAINT [CK_Employee_SickLeaveHours] CHECK ([SickLeaveHours] BETWEEN 0 AND 120)
) ON [PRIMARY];

ALTER TABLE [HumanResources].[Employee] WITH CHECK ADD
CONSTRAINT [PK_Employee_EmployeeID] PRIMARY KEY CLUSTERED
(
[EmployeeID]
) ON [PRIMARY];

ALTER TABLE [HumanResources].[Employee] ADD
CONSTRAINT [FK_Employee_Employee_ManagerID] FOREIGN KEY
(
[ManagerID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
),
CONSTRAINT [FK_Employee_Contact_ContactID] FOREIGN KEY
(
[ContactID]
) REFERENCES [Person].[Contact](
[ContactID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee information such as salary, department, and title.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Employee records.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique national identification number such as a social security number.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [NationalIDNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Identifies the employee in the Contact table. Foreign key to Contact.ContactID.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Network login.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [LoginID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Manager to whom the employee is assigned. Foreign Key to Employee.M', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work title such as Buyer or Sales Representative.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [Title];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date of birth.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [BirthDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'M = Married, S = Single', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [MaritalStatus];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'M = Male, F = Female', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [Gender];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee hired on this date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [HireDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [SalariedFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Number of available vacation hours.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [VacationHours];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Number of available sick leave hours.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [SickLeaveHours];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Inactive, 1 = Active', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [CurrentFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_LoginID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_NationalIDNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [IX_Employee_ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [PK_Employee_EmployeeID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [PK_Employee_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Contact.ContactID.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [FK_Employee_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.ManagerID.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [FK_Employee_Employee_ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [DF_Employee_SickLeaveHours]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [DF_Employee_VacationHours]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1 (TRUE)', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [DF_Employee_SalariedFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [DF_Employee_CurrentFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [DF_Employee_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [DF_Employee_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [BirthDate]>=''1930-01-01'' AND [BirthDate]<=dateadd(year,(-18),GETDATE())', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [CK_Employee_BirthDate]; -- ([BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),GETDATE()))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [HireDate]>=''1996-07-01'' AND [HireDate]<=dateadd(day,(1),GETDATE())', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [CK_Employee_HireDate]; -- ([HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),GETDATE()))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120)', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [CK_Employee_SickLeaveHours]; -- ([SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [VacationHours]>=(-40) AND [VacationHours]<=(240)', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [CK_Employee_VacationHours]; -- ([VacationHours]>=(-40) AND [VacationHours]<=(240))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Gender]=''f'' OR [Gender]=''m'' OR [Gender]=''F'' OR [Gender]=''M''', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [CK_Employee_Gender]; -- (UPPER([Gender])='F' OR UPPER([Gender])='M')
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [MaritalStatus]=''s'' OR [MaritalStatus]=''m'' OR [MaritalStatus]=''S'' OR [MaritalStatus]=''M''', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'CONSTRAINT', [CK_Employee_MaritalStatus]; -- (UPPER([MaritalStatus])='S' OR UPPER([MaritalStatus])='M')


HumanResources.EmployeeAddress - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.EmployeeAddress

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[EmployeeAddress](
[EmployeeID] [int] NOT NULL,
[AddressID] [int] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_EmployeeAddress_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_EmployeeAddress_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [HumanResources].[EmployeeAddress] WITH CHECK ADD
CONSTRAINT [PK_EmployeeAddress_EmployeeID_AddressID] PRIMARY KEY CLUSTERED
(
[EmployeeID],
[AddressID]
) ON [PRIMARY];

ALTER TABLE [HumanResources].[EmployeeAddress] ADD
CONSTRAINT [FK_EmployeeAddress_Address_AddressID] FOREIGN KEY
(
[AddressID]
) REFERENCES [Person].[Address](
[AddressID]
),
CONSTRAINT [FK_EmployeeAddress_Employee_EmployeeID] FOREIGN KEY
(
[EmployeeID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping employees to their address(es).', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'COLUMN', [EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Address.AddressID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'COLUMN', [AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'INDEX', [AK_EmployeeAddress_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'INDEX', [PK_EmployeeAddress_EmployeeID_AddressID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'CONSTRAINT', [PK_EmployeeAddress_EmployeeID_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Address.AddressID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'CONSTRAINT', [FK_EmployeeAddress_Address_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'CONSTRAINT', [FK_EmployeeAddress_Employee_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'CONSTRAINT', [DF_EmployeeAddress_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'CONSTRAINT', [DF_EmployeeAddress_rowguid]; -- (NEWID())


HumanResources.EmployeeDepartmentHistory - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.EmployeeDepartmentHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[EmployeeDepartmentHistory](
[EmployeeID] [int] NOT NULL,
[DepartmentID] [smallint] NOT NULL,
[ShiftID] [tinyint] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_EmployeeDepartmentHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_EmployeeDepartmentHistory_EndDate] CHECK (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL)),
) ON [PRIMARY];

ALTER TABLE [HumanResources].[EmployeeDepartmentHistory] WITH CHECK ADD
CONSTRAINT [PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID] PRIMARY KEY CLUSTERED
(
[EmployeeID],
[StartDate],
[DepartmentID],
[ShiftID]
) ON [PRIMARY];

ALTER TABLE [HumanResources].[EmployeeDepartmentHistory] ADD
CONSTRAINT [FK_EmployeeDepartmentHistory_Department_DepartmentID] FOREIGN KEY
(
[DepartmentID]
) REFERENCES [HumanResources].[Department](
[DepartmentID]
),
CONSTRAINT [FK_EmployeeDepartmentHistory_Employee_EmployeeID] FOREIGN KEY
(
[EmployeeID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
),
CONSTRAINT [FK_EmployeeDepartmentHistory_Shift_ShiftID] FOREIGN KEY
(
[ShiftID]
) REFERENCES [HumanResources].[Shift](
[ShiftID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee department transfers.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee identification number. Foreign key to Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'COLUMN', [EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Department in which the employee worked including currently. Foreign key to Department.DepartmentID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'COLUMN', [DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'COLUMN', [ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the employee started work in the department.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the employee left the department. NULL = Current department.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [IX_EmployeeDepartmentHistory_DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [IX_EmployeeDepartmentHistory_ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'CONSTRAINT', [PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Shift.ShiftID', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'CONSTRAINT', [FK_EmployeeDepartmentHistory_Shift_ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Department.DepartmentID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'CONSTRAINT', [FK_EmployeeDepartmentHistory_Department_DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'CONSTRAINT', [FK_EmployeeDepartmentHistory_Employee_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'CONSTRAINT', [DF_EmployeeDepartmentHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NUL', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'CONSTRAINT', [CK_EmployeeDepartmentHistory_EndDate]; -- ([EndDate]>=[StartDate] OR [EndDate] IS NULL)


HumanResources.EmployeePayHistory - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.EmployeePayHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[EmployeePayHistory](
[EmployeeID] [int] NOT NULL,
[RateChangeDate] [datetime] NOT NULL,
[Rate] [money] NOT NULL,
[PayFrequency] [tinyint] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_EmployeePayHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_EmployeePayHistory_PayFrequency] CHECK ([PayFrequency] IN (1, 2)), -- 1 = monthly salary, 2 = biweekly salary
CONSTRAINT [CK_EmployeePayHistory_Rate] CHECK ([Rate] BETWEEN 6.50 AND 200.00)
) ON [PRIMARY];

ALTER TABLE [HumanResources].[EmployeePayHistory] WITH CHECK ADD
CONSTRAINT [PK_EmployeePayHistory_EmployeeID_RateChangeDate] PRIMARY KEY CLUSTERED
(
[EmployeeID],
[RateChangeDate]
) ON [PRIMARY];

ALTER TABLE [HumanResources].[EmployeePayHistory] ADD
CONSTRAINT [FK_EmployeePayHistory_Employee_EmployeeID] FOREIGN KEY
(
[EmployeeID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee pay history.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee identification number. Foreign key to Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'COLUMN', [EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the change in pay is effective', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'COLUMN', [RateChangeDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Salary hourly rate.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'COLUMN', [Rate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'1 = Salary received monthly, 2 = Salary received biweekly', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'COLUMN', [PayFrequency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'INDEX', [PK_EmployeePayHistory_EmployeeID_RateChangeDate];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'CONSTRAINT', [PK_EmployeePayHistory_EmployeeID_RateChangeDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'CONSTRAINT', [FK_EmployeePayHistory_Employee_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'CONSTRAINT', [DF_EmployeePayHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Rate]>=(6.50) AND [Rate]<=(200.00)', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'CONSTRAINT', [CK_EmployeePayHistory_Rate]; -- ([Rate]>=(6.50) AND [Rate]<=(200.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [PayFrequency]=(3) OR [PayFrequency]=(2) OR [PayFrequency]=(1)', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'CONSTRAINT', [CK_EmployeePayHistory_PayFrequency]; -- ([PayFrequency]=(2) OR [PayFrequency]=(1))


Production.Illustration - Source code

Source code SQL 2005 Adventure Works OLTP

Production.Illustration

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[Illustration](
[IllustrationID] [int] IDENTITY (1, 1) NOT NULL,
[Diagram] [XML] NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Illustration_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[Illustration] WITH CHECK ADD
CONSTRAINT [PK_Illustration_IllustrationID] PRIMARY KEY CLUSTERED
(
[IllustrationID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Bicycle assembly diagrams.', N'SCHEMA', [Production], N'TABLE', [Illustration], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Illustration records.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'COLUMN', [IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Illustrations used in manufacturing instructions. Stored as XML.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'COLUMN', [Diagram];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'INDEX', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PXML_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for path.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPATH_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for property.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPROPERTY_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for value.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLVALUE_Individual_Demographics];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [Illustration], N'CONSTRAINT', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [Illustration], N'CONSTRAINT', [DF_Illustration_ModifiedDate]; -- (GETDATE())


Sales.Individual - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.Individual

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[Individual](
[CustomerID] [int] NOT NULL,
[ContactID] [int] NOT NULL,
[Demographics] [XML]([Sales].[IndividualSurveySchemaCollection]) NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Individual_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[Individual] WITH CHECK ADD
CONSTRAINT [PK_Individual_CustomerID] PRIMARY KEY CLUSTERED
(
[CustomerID]
) ON [PRIMARY];

ALTER TABLE [Sales].[Individual] ADD
CONSTRAINT [FK_Individual_Customer_CustomerID] FOREIGN KEY
(
[CustomerID]
) REFERENCES [Sales].[Customer](
[CustomerID]
);

ALTER TABLE [Sales].[Individual] ADD
CONSTRAINT [FK_Individual_Contact_ContactID] FOREIGN KEY
(
[ContactID]
) REFERENCES [Person].[Contact](
[ContactID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Demographic data about customers that purchase Adventure Works products online.', N'SCHEMA', [Sales], N'TABLE', [Individual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique customer identification number. Foreign key to Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'COLUMN', [CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Identifies the customer in the Contact table. Foreign key to Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'COLUMN', [Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'INDEX', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PXML_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for path.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPATH_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for property.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPROPERTY_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for value.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLVALUE_Individual_Demographics];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [Individual], N'CONSTRAINT', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'CONSTRAINT', [FK_Individual_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'CONSTRAINT', [FK_Individual_Customer_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [Individual], N'CONSTRAINT', [DF_Individual_ModifiedDate]; -- (GETDATE())


HumanResources.JobCandidate - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.JobCandidate

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[JobCandidate](
[JobCandidateID] [int] IDENTITY (1, 1) NOT NULL,
[EmployeeID] [int] NULL,
[Resume] [XML]([HumanResources].[HRResumeSchemaCollection]) NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_JobCandidate_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [HumanResources].[JobCandidate] WITH CHECK ADD
CONSTRAINT [PK_JobCandidate_JobCandidateID] PRIMARY KEY CLUSTERED
(
[JobCandidateID]
) ON [PRIMARY];

ALTER TABLE [HumanResources].[JobCandidate] ADD
CONSTRAINT [FK_JobCandidate_Employee_EmployeeID] FOREIGN KEY
(
[EmployeeID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Résumés submitted to Human Resources by job applicants.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for JobCandidate records.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'COLUMN', [JobCandidateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee identification number if applicant was hired. Foreign key to Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'COLUMN', [EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Résumé in XML format.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'COLUMN', [Resume];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'INDEX', [IX_JobCandidate_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'INDEX', [PK_JobCandidate_JobCandidateID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'CONSTRAINT', [PK_JobCandidate_JobCandidateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'CONSTRAINT', [FK_JobCandidate_Employee_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'CONSTRAINT', [DF_JobCandidate_ModifiedDate]; -- (GETDATE())


Production.Location - Source code

Source code SQL 2005 Adventure Works OLTP

Production.Location

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[Location](
[LocationID] [smallint] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[CostRate] [smallmoney] NOT NULL CONSTRAINT [DF_Location_CostRate] DEFAULT (0.00),
[Availability] [decimal](8, 2) NOT NULL CONSTRAINT [DF_Location_Availability] DEFAULT (0.00),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Location_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Location_CostRate] CHECK ([CostRate] >= 0.00),
CONSTRAINT [CK_Location_Availability] CHECK ([Availability] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Production].[Location] WITH CHECK ADD
CONSTRAINT [PK_Location_LocationID] PRIMARY KEY CLUSTERED
(
[LocationID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product inventory and manufacturing locations.', N'SCHEMA', [Production], N'TABLE', [Location], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Location records.', N'SCHEMA', [Production], N'TABLE', [Location], N'COLUMN', [LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Location description.', N'SCHEMA', [Production], N'TABLE', [Location], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Standard hourly cost of the manufacturing location.', N'SCHEMA', [Production], N'TABLE', [Location], N'COLUMN', [CostRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work capacity (in hours) of the manufacturing location.', N'SCHEMA', [Production], N'TABLE', [Location], N'COLUMN', [Availability];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [Location], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [AK_Location_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [PK_Product_ProductID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [Location], N'CONSTRAINT', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.00', N'SCHEMA', [Production], N'TABLE', [Location], N'CONSTRAINT', [DF_Location_Availability]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Production], N'TABLE', [Location], N'CONSTRAINT', [DF_Location_CostRate]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [Location], N'CONSTRAINT', [DF_Location_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Availability]>=(0.00)', N'SCHEMA', [Production], N'TABLE', [Location], N'CONSTRAINT', [CK_Location_Availability]; -- ([Availability]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [CostRate]>=(0.00)', N'SCHEMA', [Production], N'TABLE', [Location], N'CONSTRAINT', [CK_Location_CostRate]; -- ([CostRate]>=(0.00))


Production.Product - Source code

Source code SQL 2005 Adventure Works OLTP

Production.Product

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[Product](
[ProductID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[ProductNumber] [nvarchar](25) NOT NULL,
[MakeFlag] [Flag] NOT NULL CONSTRAINT [DF_Product_MakeFlag] DEFAULT (1),
[FinishedGoodsFlag] [Flag] NOT NULL CONSTRAINT [DF_Product_FinishedGoodsFlag] DEFAULT (1),
[Color] [nvarchar](15) NULL,
[SafetyStockLevel] [smallint] NOT NULL,
[ReorderPoint] [smallint] NOT NULL,
[StandardCost] [money] NOT NULL,
[ListPrice] [money] NOT NULL,
[Size] [nvarchar](5) NULL,
[SizeUnitMeasureCode] [nchar](3) NULL,
[WeightUnitMeasureCode] [nchar](3) NULL,
[Weight] [decimal](8, 2) NULL,
[DaysToManufacture] [int] NOT NULL,
[ProductLine] [nchar](2) NULL,
[Class] [nchar](2) NULL,
[Style] [nchar](2) NULL,
[ProductSubcategoryID] [int] NULL,
[ProductModelID] [int] NULL,
[SellStartDate] [datetime] NOT NULL,
[SellEndDate] [datetime] NULL,
[DiscontinuedDate] [datetime] NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Product_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Product_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Product_SafetyStockLevel] CHECK ([SafetyStockLevel] > 0),
CONSTRAINT [CK_Product_ReorderPoint] CHECK ([ReorderPoint] > 0),
CONSTRAINT [CK_Product_StandardCost] CHECK ([StandardCost] >= 0.00),
CONSTRAINT [CK_Product_ListPrice] CHECK ([ListPrice] >= 0.00),
CONSTRAINT [CK_Product_Weight] CHECK ([Weight] > 0.00),
CONSTRAINT [CK_Product_DaysToManufacture] CHECK ([DaysToManufacture] >= 0),
CONSTRAINT [CK_Product_ProductLine] CHECK (UPPER([ProductLine]) IN ('S', 'T', 'M', 'R') OR [ProductLine] IS NULL),
CONSTRAINT [CK_Product_Class] CHECK (UPPER([Class]) IN ('L', 'M', 'H') OR [Class] IS NULL),
CONSTRAINT [CK_Product_Style] CHECK (UPPER([Style]) IN ('W', 'M', 'U') OR [Style] IS NULL),
CONSTRAINT [CK_Product_SellEndDate] CHECK (([SellEndDate] >= [SellStartDate]) OR ([SellEndDate] IS NULL)),
) ON [PRIMARY];

ALTER TABLE [Production].[Product] WITH CHECK ADD
CONSTRAINT [PK_Product_ProductID] PRIMARY KEY CLUSTERED
(
[ProductID]
) ON [PRIMARY];

ALTER TABLE [Production].[Product] ADD
CONSTRAINT [FK_Product_UnitMeasure_SizeUnitMeasureCode] FOREIGN KEY
(
[SizeUnitMeasureCode]
) REFERENCES [Production].[UnitMeasure](
[UnitMeasureCode]
),
CONSTRAINT [FK_Product_UnitMeasure_WeightUnitMeasureCode] FOREIGN KEY
(
[WeightUnitMeasureCode]
) REFERENCES [Production].[UnitMeasure](
[UnitMeasureCode]
),
CONSTRAINT [FK_Product_ProductModel_ProductModelID] FOREIGN KEY
(
[ProductModelID]
) REFERENCES [Production].[ProductModel](
[ProductModelID]
),
CONSTRAINT [FK_Product_ProductSubcategory_ProductSubcategoryID] FOREIGN KEY
(
[ProductSubcategoryID]
) REFERENCES [Production].[ProductSubcategory](
[ProductSubcategoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Products sold or used in the manfacturing of sold products.', N'SCHEMA', [Production], N'TABLE', [Product], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Product records.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Name of the product.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique product identification number.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Product is purchased, 1 = Product is manufactured in-house.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [MakeFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Product is not a salable item. 1 = Product is salable.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [FinishedGoodsFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product color.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [Color];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Minimum inventory quantity. ', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [SafetyStockLevel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Inventory level that triggers a purchase order or work order. ', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ReorderPoint];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Standard cost of the product.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [StandardCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Selling price.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ListPrice];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product size.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [Size];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unit of measure for Size column.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [SizeUnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unit of measure for Weight column.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [WeightUnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product weight.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [Weight];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Number of days required to manufacture the product.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [DaysToManufacture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'R = Road, M = Mountain, T = Touring, S = Standard', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ProductLine];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'H = High, M = Medium, L = Low', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [Class];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'W = Womens, M = Mens, U = Universal', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [Style];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID. ', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ProductSubcategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product is a member of this product model. Foreign key to ProductModel.ProductModelID.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the product was available for sale.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [SellStartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the product was no longer available for sale.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [SellEndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the product was discontinued.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [DiscontinuedDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [Product], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [AK_Location_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [PK_Product_ProductID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [PK_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductModel.ProductModelID.', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [FK_Product_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductSubcategory.ProductSubcategoryID.', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [FK_Product_ProductSubcategory_ProductSubcategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing UnitMeasure.UnitMeasureCode.', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [FK_Product_UnitMeasure_SizeUnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing UnitMeasure.UnitMeasureCode.', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [FK_Product_UnitMeasure_WeightUnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [DF_Product_FinishedGoodsFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [DF_Product_MakeFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [DF_Product_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [DF_Product_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [DaysToManufacture]>=(0)', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_DaysToManufacture]; -- ([DaysToManufacture]>=(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ListPrice]>=(0.00)', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_ListPrice]; -- ([ListPrice]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ReorderPoint]>(0)', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_ReorderPoint]; -- ([ReorderPoint]>(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SafetyStockLevel]>(0)', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_SafetyStockLevel]; -- ([SafetyStockLevel]>(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SafetyStockLevel]>(0)', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_StandardCost]; -- ([StandardCost]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Weight]>(0.00)', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_Weight]; -- ([Weight]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Class]=''h'' OR [Class]=''m'' OR [Class]=''l'' OR [Class]=''H'' OR [Class]=''M'' OR [Class]=''L'' OR [Class] IS NULL', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_Class]; -- (UPPER([Class])='H' OR UPPER([Class])='M' OR UPPER([Class])='L' OR [Class] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ProductLine]=''r'' OR [ProductLine]=''m'' OR [ProductLine]=''t'' OR [ProductLine]=''s'' OR [ProductLine]=''R'' OR [ProductLine]=''M'' OR [ProductLine]=''T'' OR [ProductLine]=''S'' OR [ProductLine] IS NULL', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_ProductLine]; -- (UPPER([ProductLine])='R' OR UPPER([ProductLine])='M' OR UPPER([ProductLine])='T' OR UPPER([ProductLine])='S' OR [ProductLine] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SellEndDate] >= [SellStartDate] OR [SellEndDate] IS NULL', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_SellEndDate]; -- ([SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Style]=''u'' OR [Style]=''m'' OR [Style]=''w'' OR [Style]=''U'' OR [Style]=''M'' OR [Style]=''W'' OR [Style] IS NULL', N'SCHEMA', [Production], N'TABLE', [Product], N'CONSTRAINT', [CK_Product_Style]; -- (UPPER([Style])='U' OR UPPER([Style])='M' OR UPPER([Style])='W' OR [Style] IS NULL)


Production.ProductCategory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductCategory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductCategory](
[ProductCategoryID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_ProductCategory_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductCategory_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductCategory] WITH CHECK ADD
CONSTRAINT [PK_ProductCategory_ProductCategoryID] PRIMARY KEY CLUSTERED
(
[ProductCategoryID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'High-level product categorization.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ProductCategory records.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'COLUMN', [ProductCategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Category description.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [AK_ProductCategory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [AK_ProductCategory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [PK_ProductCategory_ProductCategoryID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'CONSTRAINT', [PK_ProductCategory_ProductCategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'CONSTRAINT', [DF_ProductCategory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()()', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'CONSTRAINT', [DF_ProductCategory_rowguid]; -- (NEWID())


Production.ProductCostHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductCostHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductCostHistory](
[ProductID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[StandardCost] [money] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductCostHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ProductCostHistory_EndDate] CHECK (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL)),
CONSTRAINT [CK_ProductCostHistory_StandardCost] CHECK ([StandardCost] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Production].[ProductCostHistory] WITH CHECK ADD
CONSTRAINT [PK_ProductCostHistory_ProductID_StartDate] PRIMARY KEY CLUSTERED
(
[ProductID],
[StartDate]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductCostHistory] ADD
CONSTRAINT [FK_ProductCostHistory_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Changes in the cost of a product over time.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product cost start date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product cost end date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Standard cost of the product.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'COLUMN', [StandardCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'INDEX', [PK_ProductCostHistory_ProductID_StartDate];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'CONSTRAINT', [PK_ProductCostHistory_ProductID_StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'CONSTRAINT', [FK_ProductCostHistory_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'CONSTRAINT', [DF_ProductCostHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [StandardCost]>=(0.00)', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'CONSTRAINT', [CK_ProductCostHistory_StandardCost]; -- ([StandardCost]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'CONSTRAINT', [CK_ProductCostHistory_EndDate]; -- ([EndDate]>=[StartDate] OR [EndDate] IS NULL)


Production.ProductDescription - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductDescription

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductDescription](
[ProductDescriptionID] [int] IDENTITY (1, 1) NOT NULL,
[Description] [nvarchar](400) NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_ProductDescription_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductDescription_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductDescription] WITH CHECK ADD
CONSTRAINT [PK_ProductDescription_ProductDescriptionID] PRIMARY KEY CLUSTERED
(
[ProductDescriptionID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product descriptions in several languages.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ProductDescription records.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'COLUMN', [ProductDescriptionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Description of the product.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'COLUMN', [Description];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'INDEX', [AK_ProductDescription_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'INDEX', [PK_ProductDescription_ProductDescriptionID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'CONSTRAINT', [PK_ProductDescription_ProductDescriptionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'CONSTRAINT', [DF_ProductDescription_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'CONSTRAINT', [DF_ProductDescription_rowguid]; -- (NEWID())


Production.ProductDocument - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductDocument

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductDocument](
[ProductID] [int] NOT NULL,
[DocumentID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductDocument_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductDocument] WITH CHECK ADD
CONSTRAINT [PK_ProductDocument_ProductID_DocumentID] PRIMARY KEY CLUSTERED
(
[ProductID],
[DocumentID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductDocument] ADD
CONSTRAINT [FK_ProductDocument_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_ProductDocument_Document_DocumentID] FOREIGN KEY
(
[DocumentID]
) REFERENCES [Production].[Document](
[DocumentID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping products to related product documents.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Document identification number. Foreign key to Document.DocumentID.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'COLUMN', [DocumentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'INDEX', [PK_ProductDocument_ProductID_DocumentID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'CONSTRAINT', [PK_ProductDocument_ProductID_DocumentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Document.DocumentID.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'CONSTRAINT', [FK_ProductDocument_Document_DocumentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'CONSTRAINT', [FK_ProductDocument_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'CONSTRAINT', [DF_ProductDocument_ModifiedDate]; -- (GETDATE())


Production.ProductInventory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductInventory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductInventory](
[ProductID] [int] NOT NULL,
[LocationID] [smallint] NOT NULL,
[Shelf] [nvarchar](10) NOT NULL,
[Bin] [tinyint] NOT NULL,
[Quantity] [smallint] NOT NULL CONSTRAINT [DF_ProductInventory_Quantity] DEFAULT (0),
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_ProductInventory_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductInventory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ProductInventory_Shelf] CHECK (([Shelf] LIKE '[A-Za-z]') OR ([Shelf] = 'N/A')),
CONSTRAINT [CK_ProductInventory_Bin] CHECK ([Bin] BETWEEN 0 AND 100)
) ON [PRIMARY];

ALTER TABLE [Production].[ProductInventory] WITH CHECK ADD
CONSTRAINT [PK_ProductInventory_ProductID_LocationID] PRIMARY KEY CLUSTERED
(
[ProductID],
[LocationID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductInventory] ADD
CONSTRAINT [FK_ProductInventory_Location_LocationID] FOREIGN KEY
(
[LocationID]
) REFERENCES [Production].[Location](
[LocationID]
),
CONSTRAINT [FK_ProductInventory_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product inventory information.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Inventory location identification number. Foreign key to Location.LocationID. ', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Storage compartment within an inventory location.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [Shelf];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Storage container on a shelf in an inventory location.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [Bin];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity of products in the inventory location.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [Quantity];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [AK_ProductInventory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [IX_ProductInventory_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [PK_ProductInventory_ProductID_LocationID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [PK_ProductInventory_ProductID_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Location.LocationID.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [FK_ProductInventory_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [FK_ProductInventory_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [DF_ProductInventory_Quantity]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [DF_ProductInventory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [DF_ProductInventory_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Bin] BETWEEN (0) AND (100)', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [CK_ProductInventory_Bin]; -- ([Bin]>=(0) AND [Bin]<=(100))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Shelf] like ''[A-Za-z]'' OR [Shelf]=''N/A''', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'CONSTRAINT', [CK_ProductInventory_Shelf]; -- ([Shelf] like '[A-Za-z]' OR [Shelf]='N/A')


Production.ProductListPriceHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductListPriceHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductListPriceHistory](
[ProductID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[ListPrice] [money] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductListPriceHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ProductListPriceHistory_EndDate] CHECK (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL)),
CONSTRAINT [CK_ProductListPriceHistory_ListPrice] CHECK ([ListPrice] > 0.00)
) ON [PRIMARY];

ALTER TABLE [Production].[ProductListPriceHistory] WITH CHECK ADD
CONSTRAINT [PK_ProductListPriceHistory_ProductID_StartDate] PRIMARY KEY CLUSTERED
(
[ProductID],
[StartDate]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductListPriceHistory] ADD
CONSTRAINT [FK_ProductListPriceHistory_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Changes in the list price of a product over time.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'List price start date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'List price end date', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product list price.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'COLUMN', [ListPrice];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'INDEX', [PK_ProductListPriceHistory_ProductID_StartDate];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'CONSTRAINT', [PK_ProductListPriceHistory_ProductID_StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'CONSTRAINT', [FK_ProductListPriceHistory_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'CONSTRAINT', [DF_ProductListPriceHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ListPrice]>(0.00)', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'CONSTRAINT', [CK_ProductListPriceHistory_ListPrice]; -- ([ListPrice]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'CONSTRAINT', [CK_ProductListPriceHistory_EndDate]; -- ([EndDate]>=[StartDate] OR [EndDate] IS NULL)


Production.ProductModel - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductModel

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductModel](
[ProductModelID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[CatalogDescription] [XML]([Production].[ProductDescriptionSchemaCollection]) NULL,
[Instructions] [XML]([Production].[ManuInstructionsSchemaCollection]) NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_ProductModel_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductModel_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductModel] WITH CHECK ADD
CONSTRAINT [PK_ProductModel_ProductModelID] PRIMARY KEY CLUSTERED
(
[ProductModelID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product model classification.', N'SCHEMA', [Production], N'TABLE', [ProductModel], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ProductModel records.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'COLUMN', [ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product model description.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Detailed product catalog information in xml format.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'COLUMN', [CatalogDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Manufacturing instructions in xml format.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'COLUMN', [Instructions];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PK_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_CatalogDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_Instructions];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'CONSTRAINT', [PK_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'CONSTRAINT', [DF_ProductModel_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'CONSTRAINT', [DF_ProductModel_rowguid]; -- (NEWID())


Production.ProductModelIllustration - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductModelIllustration

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductModelIllustration](
[ProductModelID] [int] NOT NULL,
[IllustrationID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductModelIllustration_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductModelIllustration] WITH CHECK ADD
CONSTRAINT [PK_ProductModelIllustration_ProductModelID_IllustrationID] PRIMARY KEY CLUSTERED
(
[ProductModelID],
[IllustrationID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductModelIllustration] ADD
CONSTRAINT [FK_ProductModelIllustration_ProductModel_ProductModelID] FOREIGN KEY
(
[ProductModelID]
) REFERENCES [Production].[ProductModel](
[ProductModelID]
),
CONSTRAINT [FK_ProductModelIllustration_Illustration_IllustrationID] FOREIGN KEY
(
[IllustrationID]
) REFERENCES [Production].[Illustration](
[IllustrationID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping product models and illustrations.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to ProductModel.ProductModelID.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'COLUMN', [ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Illustration.IllustrationID.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'COLUMN', [IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'INDEX', [PK_ProductModelIllustration_ProductModelID_IllustrationID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'CONSTRAINT', [PK_ProductModelIllustration_ProductModelID_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Illustration.IllustrationID.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'CONSTRAINT', [FK_ProductModelIllustration_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductModel.ProductModelID.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'CONSTRAINT', [FK_ProductModelIllustration_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'CONSTRAINT', [DF_ProductModelIllustration_ModifiedDate]; -- (GETDATE())


Production.ProductModelProductDescriptionCulture - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductModelProductDescriptionCulture

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductModelProductDescriptionCulture](
[ProductModelID] [int] NOT NULL,
[ProductDescriptionID] [int] NOT NULL,
[CultureID] [nchar](6) NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductModelProductDescriptionCulture_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductModelProductDescriptionCulture] WITH CHECK ADD
CONSTRAINT [PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID] PRIMARY KEY CLUSTERED
(
[ProductModelID],
[ProductDescriptionID],
[CultureID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductModelProductDescriptionCulture] ADD
CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID] FOREIGN KEY
(
[ProductDescriptionID]
) REFERENCES [Production].[ProductDescription](
[ProductDescriptionID]
),
CONSTRAINT [FK_ProductModelProductDescriptionCulture_Culture_CultureID] FOREIGN KEY
(
[CultureID]
) REFERENCES [Production].[Culture]
(
[CultureID]
),
CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID] FOREIGN KEY
(
[ProductModelID]
) REFERENCES [Production].[ProductModel](
[ProductModelID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping product descriptions and the language the description is written in.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to ProductModel.ProductModelID.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'COLUMN', [ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to ProductDescription.ProductDescriptionID.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'COLUMN', [ProductDescriptionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Culture identification number. Foreign key to Culture.CultureID.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'COLUMN', [CultureID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'INDEX', [PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'CONSTRAINT', [PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Culture.CultureID.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'CONSTRAINT', [FK_ProductModelProductDescriptionCulture_Culture_CultureID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductDescription.ProductDescriptionID.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'CONSTRAINT', [FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductModel.ProductModelID.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'CONSTRAINT', [FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'CONSTRAINT', [DF_ProductModelProductDescriptionCulture_ModifiedDate]; -- (GETDATE())


Production.ProductPhoto - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductPhoto

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductPhoto](
[ProductPhotoID] [int] IDENTITY (1, 1) NOT NULL,
[ThumbNailPhoto] [varbinary](max) NULL,
[ThumbnailPhotoFileName] [nvarchar](50) NULL,
[LargePhoto] [varbinary](max) NULL,
[LargePhotoFileName] [nvarchar](50) NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductPhoto_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductPhoto] WITH CHECK ADD
CONSTRAINT [PK_ProductPhoto_ProductPhotoID] PRIMARY KEY CLUSTERED
(
[ProductPhotoID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product images.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ProductPhoto records.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'COLUMN', [ProductPhotoID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Small image of the product.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'COLUMN', [ThumbNailPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Small image file name.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'COLUMN', [ThumbnailPhotoFileName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Large image of the product.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'COLUMN', [LargePhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Large image file name.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'COLUMN', [LargePhotoFileName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'INDEX', [PK_ProductPhoto_ProductPhotoID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'CONSTRAINT', [PK_ProductPhoto_ProductPhotoID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'CONSTRAINT', [DF_ProductPhoto_ModifiedDate]; -- (GETDATE())


Production.ProductProductPhoto - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductProductPhoto

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductProductPhoto](
[ProductID] [int] NOT NULL,
[ProductPhotoID] [int] NOT NULL,
[Primary] [Flag] NOT NULL CONSTRAINT [DF_ProductProductPhoto_Primary] DEFAULT (0),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductProductPhoto_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductProductPhoto] WITH CHECK ADD
CONSTRAINT [PK_ProductProductPhoto_ProductID_ProductPhotoID] PRIMARY KEY NONCLUSTERED
(
[ProductID],
[ProductPhotoID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductProductPhoto] ADD
CONSTRAINT [FK_ProductProductPhoto_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_ProductProductPhoto_ProductPhoto_ProductPhotoID] FOREIGN KEY
(
[ProductPhotoID]
) REFERENCES [Production].[ProductPhoto](
[ProductPhotoID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping products and product photos.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'COLUMN', [ProductPhotoID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Photo is not the principal image. 1 = Photo is the principal image.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'COLUMN', [Primary];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'INDEX', [AK_ProductProductPhoto_ProductID_ProductPhotoID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'INDEX', [PK_ProductProductPhoto_ProductID_ProductPhotoID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'CONSTRAINT', [PK_ProductProductPhoto_ProductID_ProductPhotoID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'CONSTRAINT', [FK_ProductProductPhoto_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductPhoto.ProductPhotoID.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'CONSTRAINT', [FK_ProductProductPhoto_ProductPhoto_ProductPhotoID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0 (FALSE)', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'CONSTRAINT', [DF_ProductProductPhoto_Primary]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'CONSTRAINT', [DF_ProductProductPhoto_ModifiedDate]; -- (GETDATE())


Production.ProductReview - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductReview

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductReview](
[ProductReviewID] [int] IDENTITY (1, 1) NOT NULL,
[ProductID] [int] NOT NULL,
[ReviewerName] [Name] NOT NULL,
[ReviewDate] [datetime] NOT NULL CONSTRAINT [DF_ProductReview_ReviewDate] DEFAULT (GETDATE()),
[EmailAddress] [nvarchar](50) NOT NULL,
[Rating] [int] NOT NULL,
[Comments] [nvarchar](3850),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductReview_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ProductReview_Rating] CHECK ([Rating] BETWEEN 1 AND 5),
) ON [PRIMARY];

ALTER TABLE [Production].[ProductReview] WITH CHECK ADD
CONSTRAINT [PK_ProductReview_ProductReviewID] PRIMARY KEY CLUSTERED
(
[ProductReviewID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductReview] ADD
CONSTRAINT [FK_ProductReview_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer reviews of products they have purchased.', N'SCHEMA', [Production], N'TABLE', [ProductReview], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ProductReview records.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [ProductReviewID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Name of the reviewer.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [ReviewerName];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date review was submitted.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [ReviewDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Reviewer''s e-mail address.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [EmailAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [Rating];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Reviewer''s comments', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [Comments];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'INDEX', [IX_ProductReview_ProductID_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'INDEX', [PK_ProductReview_ProductReviewID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'CONSTRAINT', [PK_ProductReview_ProductReviewID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'CONSTRAINT', [FK_ProductReview_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'CONSTRAINT', [DF_ProductReview_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'CONSTRAINT', [DF_ProductReview_ReviewDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Rating] BETWEEN (1) AND (5)', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'CONSTRAINT', [CK_ProductReview_Rating]; -- ([Rating]>=(1) AND [Rating]<=(5))


Production.ProductSubcategory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ProductSubcategory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ProductSubcategory](
[ProductSubcategoryID] [int] IDENTITY (1, 1) NOT NULL,
[ProductCategoryID] [int] NOT NULL,
[Name] [Name] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_ProductSubcategory_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductSubcategory_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ProductSubcategory] WITH CHECK ADD
CONSTRAINT [PK_ProductSubcategory_ProductSubcategoryID] PRIMARY KEY CLUSTERED
(
[ProductSubcategoryID]
) ON [PRIMARY];

ALTER TABLE [Production].[ProductSubcategory] ADD
CONSTRAINT [FK_ProductSubcategory_ProductCategory_ProductCategoryID] FOREIGN KEY
(
[ProductCategoryID]
) REFERENCES [Production].[ProductCategory](
[ProductCategoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product subcategories. See ProductCategory table.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ProductSubcategory records.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'COLUMN', [ProductSubcategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product category identification number. Foreign key to ProductCategory.ProductCategoryID.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'COLUMN', [ProductCategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Subcategory description.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [AK_ProductSubcategory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [AK_ProductSubcategory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [PK_ProductSubcategory_ProductSubcategoryID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'CONSTRAINT', [PK_ProductSubcategory_ProductSubcategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ProductCategory.ProductCategoryID.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'CONSTRAINT', [FK_ProductSubcategory_ProductCategory_ProductCategoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'CONSTRAINT', [DF_ProductSubcategory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'CONSTRAINT', [DF_ProductSubcategory_rowguid]; -- (NEWID())


Purchasing.ProductVendor - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.ProductVendor

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[ProductVendor](
[ProductID] [int] NOT NULL,
[VendorID] [int] NOT NULL,
[AverageLeadTime] [int] NOT NULL,
[StandardPrice] [money] NOT NULL,
[LastReceiptCost] [money] NULL,
[LastReceiptDate] [datetime] NULL,
[MinOrderQty] [int] NOT NULL,
[MaxOrderQty] [int] NOT NULL,
[OnOrderQty] [int] NULL,
[UnitMeasureCode] [nchar](3) NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductVendor_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ProductVendor_AverageLeadTime] CHECK ([AverageLeadTime] >= 1),
CONSTRAINT [CK_ProductVendor_StandardPrice] CHECK ([StandardPrice] > 0.00),
CONSTRAINT [CK_ProductVendor_LastReceiptCost] CHECK ([LastReceiptCost] > 0.00),
CONSTRAINT [CK_ProductVendor_MinOrderQty] CHECK ([MinOrderQty] >= 1),
CONSTRAINT [CK_ProductVendor_MaxOrderQty] CHECK ([MaxOrderQty] >= 1),
CONSTRAINT [CK_ProductVendor_OnOrderQty] CHECK ([OnOrderQty] >= 0)
) ON [PRIMARY];

ALTER TABLE [Purchasing].[ProductVendor] WITH CHECK ADD
CONSTRAINT [PK_ProductVendor_ProductID_VendorID] PRIMARY KEY CLUSTERED
(
[ProductID],
[VendorID]
) ON [PRIMARY];

ALTER TABLE [Purchasing].[ProductVendor] ADD
CONSTRAINT [FK_ProductVendor_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_ProductVendor_UnitMeasure_UnitMeasureCode] FOREIGN KEY
(
[UnitMeasureCode]
) REFERENCES [Production].[UnitMeasure](
[UnitMeasureCode]
),
CONSTRAINT [FK_ProductVendor_Vendor_VendorID] FOREIGN KEY
(
[VendorID]
) REFERENCES [Purchasing].[Vendor](
[VendorID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping vendors with the products they supply.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Product.ProductID.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The average span of time (in days) between placing an order with the vendor and receiving the purchased product.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [AverageLeadTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The vendor''s usual selling price.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [StandardPrice];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The selling price when last purchased.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [LastReceiptCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the product was last received by the vendor.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [LastReceiptDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The maximum quantity that should be ordered.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [MinOrderQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The minimum quantity that should be ordered.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [MaxOrderQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The quantity currently on order.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [OnOrderQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'The product''s unit of measure.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [IX_ProductVendor_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [IX_ProductVendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [PK_ProductVendor_ProductID_VendorID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [PK_ProductVendor_ProductID_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [FK_ProductVendor_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing UnitMeasure.UnitMeasureCode.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [FK_ProductVendor_UnitMeasure_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [FK_ProductVendor_Vendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [DF_ProductVendor_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [AverageLeadTime]>=(1)', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [CK_ProductVendor_AverageLeadTime]; -- ([AverageLeadTime]>=(1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [LastReceiptCost]>(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [CK_ProductVendor_LastReceiptCost]; -- ([LastReceiptCost]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [MaxOrderQty]>=(1)', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [CK_ProductVendor_MaxOrderQty]; -- ([MaxOrderQty]>=(1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [MinOrderQty]>=(1)', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [CK_ProductVendor_MinOrderQty]; -- ([MinOrderQty]>=(1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [OnOrderQty]>=(0)', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [CK_ProductVendor_OnOrderQty]; -- ([OnOrderQty]>=(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [StandardPrice]>(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'CONSTRAINT', [CK_ProductVendor_StandardPrice]; -- ([StandardPrice]>(0.00))


Purchasing.PurchaseOrderDetail - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.PurchaseOrderDetail

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[PurchaseOrderDetail](
[PurchaseOrderID] [int] NOT NULL,
[PurchaseOrderDetailID] [int] IDENTITY (1, 1) NOT NULL,
[DueDate] [datetime] NOT NULL,
[OrderQty] [smallint] NOT NULL,
[ProductID] [int] NOT NULL,
[UnitPrice] [money] NOT NULL,
[LineTotal] AS ISNULL([OrderQty] * [UnitPrice], 0.00),
[ReceivedQty] [decimal](8, 2) NOT NULL,
[RejectedQty] [decimal](8, 2) NOT NULL,
[StockedQty] AS ISNULL([ReceivedQty] - [RejectedQty], 0.00),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_PurchaseOrderDetail_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_PurchaseOrderDetail_OrderQty] CHECK ([OrderQty] > 0),
CONSTRAINT [CK_PurchaseOrderDetail_UnitPrice] CHECK ([UnitPrice] >= 0.00),
CONSTRAINT [CK_PurchaseOrderDetail_ReceivedQty] CHECK ([ReceivedQty] >= 0.00),
CONSTRAINT [CK_PurchaseOrderDetail_RejectedQty] CHECK ([RejectedQty] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Purchasing].[PurchaseOrderDetail] WITH CHECK ADD
CONSTRAINT [PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID] PRIMARY KEY CLUSTERED
(
[PurchaseOrderID],
[PurchaseOrderDetailID]
) ON [PRIMARY];

ALTER TABLE [Purchasing].[PurchaseOrderDetail] ADD
CONSTRAINT [FK_PurchaseOrderDetail_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID] FOREIGN KEY
(
[PurchaseOrderID]
) REFERENCES [Purchasing].[PurchaseOrderHeader](
[PurchaseOrderID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual products associated with a specific purchase order. See PurchaseOrderHeader.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to PurchaseOrderHeader.PurchaseOrderID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [PurchaseOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. One line number per purchased product.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [PurchaseOrderDetailID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the product is expected to be received.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [DueDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity ordered.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [OrderQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor''s selling price of a single product.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [UnitPrice];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Per product subtotal. Computed as OrderQty * UnitPrice.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [LineTotal];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity actually received from the vendor.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [ReceivedQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity rejected during inspection.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [RejectedQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity accepted into inventory. Computed as ReceivedQty - RejectedQty.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [StockedQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'INDEX', [IX_PurchaseOrderDetail_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'INDEX', [PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [FK_PurchaseOrderDetail_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing PurchaseOrderHeader.PurchaseOrderID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [DF_PurchaseOrderDetail_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [OrderQty]>(0)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [CK_PurchaseOrderDetail_OrderQty]; -- ([OrderQty]>(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ReceivedQty]>=(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [CK_PurchaseOrderDetail_ReceivedQty]; -- ([ReceivedQty]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [RejectedQty]>=(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [CK_PurchaseOrderDetail_RejectedQty]; -- ([RejectedQty]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [UnitPrice]>=(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'CONSTRAINT', [CK_PurchaseOrderDetail_UnitPrice]; -- ([UnitPrice]>=(0.00))


Purchasing.PurchaseOrderHeader - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.PurchaseOrderHeader

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[PurchaseOrderHeader](
[PurchaseOrderID] [int] IDENTITY (1, 1) NOT NULL,
[RevisionNumber] [tinyint] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_RevisionNumber] DEFAULT (0),
[Status] [tinyint] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_Status] DEFAULT (1),
[EmployeeID] [int] NOT NULL,
[VendorID] [int] NOT NULL,
[ShipMethodID] [int] NOT NULL,
[OrderDate] [datetime] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_OrderDate] DEFAULT (GETDATE()),
[ShipDate] [datetime] NULL,
[SubTotal] [money] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_SubTotal] DEFAULT (0.00),
[TaxAmt] [money] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_TaxAmt] DEFAULT (0.00),
[Freight] [money] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_Freight] DEFAULT (0.00),
[TotalDue] AS ISNULL([SubTotal] + [TaxAmt] + [Freight], 0) PERSISTED NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_PurchaseOrderHeader_Status] CHECK ([Status] BETWEEN 1 AND 4), -- 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete
CONSTRAINT [CK_PurchaseOrderHeader_ShipDate] CHECK (([ShipDate] >= [OrderDate]) OR ([ShipDate] IS NULL)),
CONSTRAINT [CK_PurchaseOrderHeader_SubTotal] CHECK ([SubTotal] >= 0.00),
CONSTRAINT [CK_PurchaseOrderHeader_TaxAmt] CHECK ([TaxAmt] >= 0.00),
CONSTRAINT [CK_PurchaseOrderHeader_Freight] CHECK ([Freight] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Purchasing].[PurchaseOrderHeader] WITH CHECK ADD
CONSTRAINT [PK_PurchaseOrderHeader_PurchaseOrderID] PRIMARY KEY CLUSTERED
(
[PurchaseOrderID]
) ON [PRIMARY];

ALTER TABLE [Purchasing].[PurchaseOrderHeader] ADD
CONSTRAINT [FK_PurchaseOrderHeader_Employee_EmployeeID] FOREIGN KEY
(
[EmployeeID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
),
CONSTRAINT [FK_PurchaseOrderHeader_Vendor_VendorID] FOREIGN KEY
(
[VendorID]
) REFERENCES [Purchasing].[Vendor](
[VendorID]
),
CONSTRAINT [FK_PurchaseOrderHeader_ShipMethod_ShipMethodID] FOREIGN KEY
(
[ShipMethodID]
) REFERENCES [Purchasing].[ShipMethod](
[ShipMethodID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'General purchase order information. See PurchaseOrderDetail.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [PurchaseOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Incremental number to track changes to the purchase order over time.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [RevisionNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [Status];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee who created the purchase order. Foreign key to Employee.EmployeeID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor with whom the purchase order is placed. Foreign key to Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping method. Foreign key to ShipMethod.ShipMethodID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [ShipMethodID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Purchase order creation date.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [OrderDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Estimated shipment date from the vendor.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [ShipDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [SubTotal];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Tax amount.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [TaxAmt];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping cost.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [Freight];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Total due to vendor. Computed as Subtotal + TaxAmt + Freight.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [TotalDue];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [IX_PurchaseOrderHeader_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [IX_PurchaseOrderHeader_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [PK_PurchaseOrderHeader_PurchaseOrderID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [PK_PurchaseOrderHeader_PurchaseOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [FK_PurchaseOrderHeader_Employee_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ShipMethod.ShipMethodID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [FK_PurchaseOrderHeader_ShipMethod_ShipMethodID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [FK_PurchaseOrderHeader_Vendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_RevisionNumber]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_Freight]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_SubTotal]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_TaxAmt]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_Status]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [DF_PurchaseOrderHeader_OrderDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Freight]>=(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [CK_PurchaseOrderHeader_Freight]; -- ([Freight]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SubTotal]>=(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [CK_PurchaseOrderHeader_SubTotal]; -- ([SubTotal]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [TaxAmt]>=(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [CK_PurchaseOrderHeader_TaxAmt]; -- ([TaxAmt]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ShipDate] >= [OrderDate] OR [ShipDate] IS NULL', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [CK_PurchaseOrderHeader_ShipDate]; -- ([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Status] BETWEEN (1) AND (4)', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'CONSTRAINT', [CK_PurchaseOrderHeader_Status]; -- ([Status]>=(1) AND [Status]<=(4))


Sales.SalesOrderDetail - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesOrderDetail

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesOrderDetail](
[SalesOrderID] [int] NOT NULL,
[SalesOrderDetailID] [int] IDENTITY (1, 1) NOT NULL,
[CarrierTrackingNumber] [nvarchar](25) NULL,
[OrderQty] [smallint] NOT NULL,
[ProductID] [int] NOT NULL,
[SpecialOfferID] [int] NOT NULL,
[UnitPrice] [money] NOT NULL,
[UnitPriceDiscount] [money] NOT NULL CONSTRAINT [DF_SalesOrderDetail_UnitPriceDiscount] DEFAULT (0.0),
[LineTotal] AS ISNULL([UnitPrice] * (1.0 - [UnitPriceDiscount]) * [OrderQty], 0.0),
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesOrderDetail_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesOrderDetail_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesOrderDetail_OrderQty] CHECK ([OrderQty] > 0),
CONSTRAINT [CK_SalesOrderDetail_UnitPrice] CHECK ([UnitPrice] >= 0.00),
CONSTRAINT [CK_SalesOrderDetail_UnitPriceDiscount] CHECK ([UnitPriceDiscount] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesOrderDetail] WITH CHECK ADD
CONSTRAINT [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID] PRIMARY KEY CLUSTERED
(
[SalesOrderID],
[SalesOrderDetailID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesOrderDetail] ADD
CONSTRAINT [FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID] FOREIGN KEY
(
[SalesOrderID]
) REFERENCES [Sales].[SalesOrderHeader](
[SalesOrderID]
) ON DELETE CASCADE,
CONSTRAINT [FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID] FOREIGN KEY
(
[SpecialOfferID],
[ProductID]
) REFERENCES [Sales].[SpecialOfferProduct](
[SpecialOfferID],
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual products associated with a specific sales order. See SalesOrderHeader.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to SalesOrderHeader.SalesOrderID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [SalesOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. One line number per product sold.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [SalesOrderDetailID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipment tracking number supplied by the shipper.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [CarrierTrackingNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity ordered per product.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [OrderQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product sold to customer. Foreign key to Product.ProductID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Promotional code. Foreign key to SpecialOffer.SpecialOfferID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [SpecialOfferID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Selling price of a single product.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [UnitPrice];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Discount amount.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [UnitPriceDiscount];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [LineTotal];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [AK_SalesOrderDetail_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [IX_SalesOrderDetail_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesOrderHeader.PurchaseOrderID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SpecialOfferProduct.SpecialOfferIDProductID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [DF_SalesOrderDetail_UnitPriceDiscount]; -- ((0.0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [DF_SalesOrderDetail_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [DF_SalesOrderDetail_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [OrderQty]>(0)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [CK_SalesOrderDetail_OrderQty]; -- ([OrderQty]>(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [UnitPrice]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [CK_SalesOrderDetail_UnitPrice]; -- ([UnitPrice]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [UnitPriceDiscount]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'CONSTRAINT', [CK_SalesOrderDetail_UnitPriceDiscount]; -- ([UnitPriceDiscount]>=(0.00))


Sales.SalesOrderHeader - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesOrderHeader

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesOrderHeader](
[SalesOrderID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
[RevisionNumber] [tinyint] NOT NULL CONSTRAINT [DF_SalesOrderHeader_RevisionNumber] DEFAULT (0),
[OrderDate] [datetime] NOT NULL CONSTRAINT [DF_SalesOrderHeader_OrderDate] DEFAULT (GETDATE()),
[DueDate] [datetime] NOT NULL,
[ShipDate] [datetime] NULL,
[Status] [tinyint] NOT NULL CONSTRAINT [DF_SalesOrderHeader_Status] DEFAULT (1),
[OnlineOrderFlag] [Flag] NOT NULL CONSTRAINT [DF_SalesOrderHeader_OnlineOrderFlag] DEFAULT (1),
[SalesOrderNumber] AS ISNULL(N'SO' + CONVERT(nvarchar(23), [SalesOrderID]), N'*** ERROR ***'),
[PurchaseOrderNumber] [OrderNumber] NULL,
[AccountNumber] [AccountNumber] NULL,
[CustomerID] [int] NOT NULL,
[ContactID] [int] NOT NULL,
[SalesPersonID] [int] NULL,
[TerritoryID] [int] NULL,
[BillToAddressID] [int] NOT NULL,
[ShipToAddressID] [int] NOT NULL,
[ShipMethodID] [int] NOT NULL,
[CreditCardID] [int] NULL,
[CreditCardApprovalCode] [varchar](15) NULL,
[CurrencyRateID] [int] NULL,
[SubTotal] [money] NOT NULL CONSTRAINT [DF_SalesOrderHeader_SubTotal] DEFAULT (0.00),
[TaxAmt] [money] NOT NULL CONSTRAINT [DF_SalesOrderHeader_TaxAmt] DEFAULT (0.00),
[Freight] [money] NOT NULL CONSTRAINT [DF_SalesOrderHeader_Freight] DEFAULT (0.00),
[TotalDue] AS ISNULL([SubTotal] + [TaxAmt] + [Freight], 0),
[Comment] [nvarchar](128) NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesOrderHeader_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesOrderHeader_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesOrderHeader_Status] CHECK ([Status] BETWEEN 0 AND 8),
CONSTRAINT [CK_SalesOrderHeader_DueDate] CHECK ([DueDate] >= [OrderDate]),
CONSTRAINT [CK_SalesOrderHeader_ShipDate] CHECK (([ShipDate] >= [OrderDate]) OR ([ShipDate] IS NULL)),
CONSTRAINT [CK_SalesOrderHeader_SubTotal] CHECK ([SubTotal] >= 0.00),
CONSTRAINT [CK_SalesOrderHeader_TaxAmt] CHECK ([TaxAmt] >= 0.00),
CONSTRAINT [CK_SalesOrderHeader_Freight] CHECK ([Freight] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesOrderHeader] WITH CHECK ADD
CONSTRAINT [PK_SalesOrderHeader_SalesOrderID] PRIMARY KEY CLUSTERED
(
[SalesOrderID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesOrderHeader] ADD
CONSTRAINT [FK_SalesOrderHeader_Address_BillToAddressID] FOREIGN KEY
(
[BillToAddressID]
) REFERENCES [Person].[Address](
[AddressID]
),
CONSTRAINT [FK_SalesOrderHeader_Address_ShipToAddressID] FOREIGN KEY
(
[ShipToAddressID]
) REFERENCES [Person].[Address](
[AddressID]
),
CONSTRAINT [FK_SalesOrderHeader_Contact_ContactID] FOREIGN KEY
(
[ContactID]
) REFERENCES [Person].[Contact](
[ContactID]
),
CONSTRAINT [FK_SalesOrderHeader_CreditCard_CreditCardID] FOREIGN KEY
(
[CreditCardID]
) REFERENCES [Sales].[CreditCard](
[CreditCardID]
),
CONSTRAINT [FK_SalesOrderHeader_CurrencyRate_CurrencyRateID] FOREIGN KEY
(
[CurrencyRateID]
) REFERENCES [Sales].[CurrencyRate](
[CurrencyRateID]
),
CONSTRAINT [FK_SalesOrderHeader_Customer_CustomerID] FOREIGN KEY
(
[CustomerID]
) REFERENCES [Sales].[Customer](
[CustomerID]
),
CONSTRAINT [FK_SalesOrderHeader_SalesPerson_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [Sales].[SalesPerson](
[SalesPersonID]
),
CONSTRAINT [FK_SalesOrderHeader_ShipMethod_ShipMethodID] FOREIGN KEY
(
[ShipMethodID]
) REFERENCES [Purchasing].[ShipMethod](
[ShipMethodID]
),
CONSTRAINT [FK_SalesOrderHeader_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [Sales].[SalesTerritory](
[TerritoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'General sales order information.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [SalesOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Incremental number to track changes to the sales order over time.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [RevisionNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Dates the sales order was created.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [OrderDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the order is due to the customer.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [DueDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the order was shipped to the customer.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [ShipDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [Status];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Order placed by sales person. 1 = Order placed online by customer.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [OnlineOrderFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique sales order identification number.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [SalesOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer purchase order number reference. ', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [PurchaseOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Financial accounting number reference.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer identification number. Foreign key to Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer contact identification number. Foreign key to Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer billing address. Foreign key to Address.AddressID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [BillToAddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customer shipping address. Foreign key to Address.AddressID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [ShipToAddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping method. Foreign key to ShipMethod.ShipMethodID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [ShipMethodID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Credit card identification number. Foreign key to CreditCard.CreditCardID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Approval code provided by the credit card company.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [CreditCardApprovalCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [CurrencyRateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [SubTotal];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Tax amount.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [TaxAmt];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping cost.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [Freight];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Total due from customer. Computed as Subtotal + TaxAmt + Freight.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [TotalDue];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representative comments.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [Comment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_SalesOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [PK_SalesOrderHeader_SalesOrderID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [PK_SalesOrderHeader_SalesOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Address.AddressID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_Address_BillToAddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Address.AddressID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_Address_ShipToAddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing CreditCard.CreditCardID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_CreditCard_CreditCardID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing CurrencyRate.CurrencyRateID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_CurrencyRate_CurrencyRateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_Customer_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesPerson.SalesPersonID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_SalesPerson_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesTerritory.TerritoryID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_SalesTerritory_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ShipMethod.ShipMethodID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [FK_SalesOrderHeader_ShipMethod_ShipMethodID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_RevisionNumber]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_Freight]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_SubTotal]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_TaxAmt]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1 (TRUE)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_OnlineOrderFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_Status]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_OrderDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [DF_SalesOrderHeader_rowguid]; -- (NEWID())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Freight]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [CK_SalesOrderHeader_Freight]; -- ([Freight]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SubTotal]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [CK_SalesOrderHeader_SubTotal]; -- ([SubTotal]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [TaxAmt]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [CK_SalesOrderHeader_TaxAmt]; -- ([TaxAmt]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [DueDate] >= [OrderDate]', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [CK_SalesOrderHeader_DueDate]; -- ([DueDate]>=[OrderDate])
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ShipDate] >= [OrderDate] OR [ShipDate] IS NULL', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [CK_SalesOrderHeader_ShipDate]; -- ([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Status] BETWEEN (0) AND (8)', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'CONSTRAINT', [CK_SalesOrderHeader_Status]; -- ([Status]>=(0) AND [Status]<=(8))


Sales.SalesOrderHeaderSalesReason - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesOrderHeaderSalesReason

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesOrderHeaderSalesReason](
[SalesOrderID] [int] NOT NULL,
[SalesReasonID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesOrderHeaderSalesReason_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesOrderHeaderSalesReason] WITH CHECK ADD
CONSTRAINT [PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID] PRIMARY KEY CLUSTERED
(
[SalesOrderID],
[SalesReasonID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesOrderHeaderSalesReason] ADD
CONSTRAINT [FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID] FOREIGN KEY
(
[SalesReasonID]
) REFERENCES [Sales].[SalesReason](
[SalesReasonID]
),
CONSTRAINT [FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID] FOREIGN KEY
(
[SalesOrderID]
) REFERENCES [Sales].[SalesOrderHeader](
[SalesOrderID]
) ON DELETE CASCADE;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping sales orders to sales reason codes.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to SalesOrderHeader.SalesOrderID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'COLUMN', [SalesOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to SalesReason.SalesReasonID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'COLUMN', [SalesReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'INDEX', [PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'CONSTRAINT', [PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesOrderHeader.SalesOrderID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'CONSTRAINT', [FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesReason.SalesReasonID.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'CONSTRAINT', [FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'CONSTRAINT', [DF_SalesOrderHeaderSalesReason_ModifiedDate]; -- (GETDATE())


Sales.SalesPerson - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesPerson

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesPerson](
[SalesPersonID] [int] NOT NULL,
[TerritoryID] [int] NULL,
[SalesQuota] [money] NULL,
[Bonus] [money] NOT NULL CONSTRAINT [DF_SalesPerson_Bonus] DEFAULT (0.00),
[CommissionPct] [smallmoney] NOT NULL CONSTRAINT [DF_SalesPerson_CommissionPct] DEFAULT (0.00),
[SalesYTD] [money] NOT NULL CONSTRAINT [DF_SalesPerson_SalesYTD] DEFAULT (0.00),
[SalesLastYear] [money] NOT NULL CONSTRAINT [DF_SalesPerson_SalesLastYear] DEFAULT (0.00),
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesPerson_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesPerson_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesPerson_SalesQuota] CHECK ([SalesQuota] > 0.00),
CONSTRAINT [CK_SalesPerson_Bonus] CHECK ([Bonus] >= 0.00),
CONSTRAINT [CK_SalesPerson_CommissionPct] CHECK ([CommissionPct] >= 0.00),
CONSTRAINT [CK_SalesPerson_SalesYTD] CHECK ([SalesYTD] >= 0.00),
CONSTRAINT [CK_SalesPerson_SalesLastYear] CHECK ([SalesLastYear] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesPerson] WITH CHECK ADD
CONSTRAINT [PK_SalesPerson_SalesPersonID] PRIMARY KEY CLUSTERED
(
[SalesPersonID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesPerson] ADD
CONSTRAINT [FK_SalesPerson_Employee_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [HumanResources].[Employee](
[EmployeeID]
),
CONSTRAINT [FK_SalesPerson_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [Sales].[SalesTerritory](
[TerritoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representative current information.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SalesPerson records.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Territory currently assigned to. Foreign key to SalesTerritory.SalesTerritoryID.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Projected yearly sales.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [SalesQuota];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Bonus due if quota is met.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [Bonus];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Commision percent received per sale.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [CommissionPct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales total year to date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [SalesYTD];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales total of previous year.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [SalesLastYear];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'INDEX', [AK_SalesPerson_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'INDEX', [PK_SalesPerson_SalesPersonID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [PK_SalesPerson_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [FK_SalesPerson_Employee_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesTerritory.TerritoryID.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [FK_SalesPerson_SalesTerritory_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [DF_SalesPerson_Bonus]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [DF_SalesPerson_CommissionPct]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [DF_SalesPerson_SalesLastYear]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [DF_SalesPerson_SalesYTD]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [DF_SalesPerson_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [DF_SalesPerson_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Bonus]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [CK_SalesPerson_Bonus]; -- ([Bonus]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [CommissionPct]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [CK_SalesPerson_CommissionPct]; -- ([CommissionPct]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SalesLastYear]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [CK_SalesPerson_SalesLastYear]; -- ([SalesLastYear]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SalesQuota]>(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [CK_SalesPerson_SalesQuota]; -- ([SalesQuota]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SalesYTD]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'CONSTRAINT', [CK_SalesPerson_SalesYTD]; -- ([SalesYTD]>=(0.00))


Sales.SalesPersonQuotaHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesPersonQuotaHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesPersonQuotaHistory](
[SalesPersonID] [int] NOT NULL,
[QuotaDate] [datetime] NOT NULL,
[SalesQuota] [money] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesPersonQuotaHistory_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesPersonQuotaHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesPersonQuotaHistory_SalesQuota] CHECK ([SalesQuota] > 0.00)
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesPersonQuotaHistory] WITH CHECK ADD
CONSTRAINT [PK_SalesPersonQuotaHistory_SalesPersonID_QuotaDate] PRIMARY KEY CLUSTERED
(
[SalesPersonID],
[QuotaDate] --,
-- [ProductCategoryID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesPersonQuotaHistory] ADD
CONSTRAINT [FK_SalesPersonQuotaHistory_SalesPerson_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [Sales].[SalesPerson](
[SalesPersonID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales performance tracking.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales person identification number. Foreign key to SalesPerson.SalesPersonID.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'COLUMN', [SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales quota date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'COLUMN', [QuotaDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales quota amount.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'COLUMN', [SalesQuota];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'INDEX', [AK_SalesPersonQuotaHistory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'INDEX', [PK_SalesPersonQuotaHistory_SalesPersonID_QuotaDate];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'CONSTRAINT', [PK_SalesPersonQuotaHistory_SalesPersonID_QuotaDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesPerson.SalesPersonID.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'CONSTRAINT', [FK_SalesPersonQuotaHistory_SalesPerson_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'CONSTRAINT', [DF_SalesPersonQuotaHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'CONSTRAINT', [DF_SalesPersonQuotaHistory_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SalesQuota]>(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'CONSTRAINT', [CK_SalesPersonQuotaHistory_SalesQuota]; -- ([SalesQuota]>(0.00))


Sales.SalesReason - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesReason

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesReason](
[SalesReasonID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[ReasonType] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesReason_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesReason] WITH CHECK ADD
CONSTRAINT [PK_SalesReason_SalesReasonID] PRIMARY KEY CLUSTERED
(
[SalesReasonID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Lookup table of customer purchase reasons.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SalesReason records.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'COLUMN', [SalesReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales reason description.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Category the sales reason belongs to.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'COLUMN', [ReasonType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'INDEX', [PK_SalesReason_SalesReasonID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'CONSTRAINT', [PK_SalesReason_SalesReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'CONSTRAINT', [DF_SalesReason_ModifiedDate]; -- (GETDATE())


Sales.SalesTaxRate - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesTaxRate

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesTaxRate](
[SalesTaxRateID] [int] IDENTITY (1, 1) NOT NULL,
[StateProvinceID] [int] NOT NULL,
[TaxType] [tinyint] NOT NULL,
[TaxRate] [smallmoney] NOT NULL CONSTRAINT [DF_SalesTaxRate_TaxRate] DEFAULT (0.00),
[Name] [Name] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesTaxRate_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesTaxRate_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesTaxRate_TaxType] CHECK ([TaxType] BETWEEN 1 AND 3)
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesTaxRate] WITH CHECK ADD
CONSTRAINT [PK_SalesTaxRate_SalesTaxRateID] PRIMARY KEY CLUSTERED
(
[SalesTaxRateID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesTaxRate] ADD
CONSTRAINT [FK_SalesTaxRate_StateProvince_StateProvinceID] FOREIGN KEY
(
[StateProvinceID]
) REFERENCES [Person].[StateProvince](
[StateProvinceID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Tax rate lookup table.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SalesTaxRate records.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [SalesTaxRateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'State, province, or country/region the sales tax applies to.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [TaxType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Tax rate amount.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [TaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Tax rate description.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [AK_SalesTaxRate_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [AK_SalesTaxRate_StateProvinceID_TaxType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [PK_SalesTaxRate_SalesTaxRateID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'CONSTRAINT', [PK_SalesTaxRate_SalesTaxRateID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing StateProvince.StateProvinceID.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'CONSTRAINT', [FK_SalesTaxRate_StateProvince_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'CONSTRAINT', [DF_SalesTaxRate_TaxRate]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'CONSTRAINT', [DF_SalesTaxRate_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'CONSTRAINT', [DF_SalesTaxRate_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [TaxType] BETWEEN (1) AND (3)', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'CONSTRAINT', [CK_SalesTaxRate_TaxType]; -- ([TaxType]>=(1) AND [TaxType]<=(3))


Sales.SalesTerritory - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesTerritory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesTerritory](
[TerritoryID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[CountryRegionCode] [nvarchar](3) NOT NULL,
[Group] [nvarchar](50) NOT NULL,
[SalesYTD] [money] NOT NULL CONSTRAINT [DF_SalesTerritory_SalesYTD] DEFAULT (0.00),
[SalesLastYear] [money] NOT NULL CONSTRAINT [DF_SalesTerritory_SalesLastYear] DEFAULT (0.00),
[CostYTD] [money] NOT NULL CONSTRAINT [DF_SalesTerritory_CostYTD] DEFAULT (0.00),
[CostLastYear] [money] NOT NULL CONSTRAINT [DF_SalesTerritory_CostLastYear] DEFAULT (0.00),
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesTerritory_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesTerritory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesTerritory_SalesYTD] CHECK ([SalesYTD] >= 0.00),
CONSTRAINT [CK_SalesTerritory_SalesLastYear] CHECK ([SalesLastYear] >= 0.00),
CONSTRAINT [CK_SalesTerritory_CostYTD] CHECK ([CostYTD] >= 0.00),
CONSTRAINT [CK_SalesTerritory_CostLastYear] CHECK ([CostLastYear] >= 0.00)
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesTerritory] WITH CHECK ADD
CONSTRAINT [PK_SalesTerritory_TerritoryID] PRIMARY KEY CLUSTERED
(
[TerritoryID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales territory lookup table.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SalesTerritory records.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales territory description', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. ', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Geographic area to which the sales territory belong.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [Group];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales in the territory year to date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [SalesYTD];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales in the territory the previous year.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [SalesLastYear];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Business costs in the territory year to date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [CostYTD];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Business costs in the territory the previous year.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [CostLastYear];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [AK_SalesTerritory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [AK_SalesTerritory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [PK_SalesTerritory_TerritoryID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [PK_SalesTerritory_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [DF_SalesTerritory_CostLastYear]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [DF_SalesTerritory_CostYTD]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [DF_SalesTerritory_SalesLastYear]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [DF_SalesTerritory_SalesYTD]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [DF_SalesTerritory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [DF_SalesTerritory_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [CostLastYear]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [CK_SalesTerritory_CostLastYear]; -- ([CostLastYear]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [CostYTD]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [CK_SalesTerritory_CostYTD]; -- ([CostYTD]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SalesLastYear]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [CK_SalesTerritory_SalesLastYear]; -- ([SalesLastYear]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [SalesYTD]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'CONSTRAINT', [CK_SalesTerritory_SalesYTD]; -- ([SalesYTD]>=(0.00))


Sales.SalesTerritoryHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SalesTerritoryHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SalesTerritoryHistory](
[SalesPersonID] [int] NOT NULL,
[TerritoryID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesTerritoryHistory_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesTerritoryHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SalesTerritoryHistory_EndDate] CHECK (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL))
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesTerritoryHistory] WITH CHECK ADD
CONSTRAINT [PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID] PRIMARY KEY CLUSTERED
(
[SalesPersonID],
[StartDate],
[TerritoryID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SalesTerritoryHistory] ADD
CONSTRAINT [FK_SalesTerritoryHistory_SalesPerson_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [Sales].[SalesPerson](
[SalesPersonID]
),
CONSTRAINT [FK_SalesTerritoryHistory_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [Sales].[SalesTerritory](
[TerritoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representative transfers to other sales territories.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SalesTerritoryHistory records.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'COLUMN', [SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'COLUMN', [TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the sales representive started work in the territory.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the sales representative left work in the territory.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'INDEX', [AK_SalesTerritoryHistory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'INDEX', [PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'CONSTRAINT', [PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesPerson.SalesPersonID.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'CONSTRAINT', [FK_SalesTerritoryHistory_SalesPerson_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesTerritory.TerritoryID.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'CONSTRAINT', [FK_SalesTerritoryHistory_SalesTerritory_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'CONSTRAINT', [DF_SalesTerritoryHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'CONSTRAINT', [DF_SalesTerritoryHistory_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'CONSTRAINT', [CK_SalesTerritoryHistory_EndDate]; -- ([EndDate]>=[StartDate] OR [EndDate] IS NULL)


Production.ScrapReason - Source code

Source code SQL 2005 Adventure Works OLTP

Production.ScrapReason

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[ScrapReason](
[ScrapReasonID] [smallint] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ScrapReason_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[ScrapReason] WITH CHECK ADD
CONSTRAINT [PK_ScrapReason_ScrapReasonID] PRIMARY KEY CLUSTERED
(
[ScrapReasonID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Manufacturing failure reasons lookup table.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ScrapReason records.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'COLUMN', [ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Failure description.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'INDEX', [AK_ScrapReason_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'INDEX', [PK_ScrapReason_ScrapReasonID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'CONSTRAINT', [PK_ScrapReason_ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'CONSTRAINT', [DF_ScrapReason_ModifiedDate]; -- (GETDATE())


HumanResources.Shift - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.Shift

Summary listing Bookmark Print Locate in contents

CREATE TABLE [HumanResources].[Shift](
[ShiftID] [tinyint] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[StartTime] [datetime] NOT NULL,
[EndTime] [datetime] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Shift_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [HumanResources].[Shift] WITH CHECK ADD
CONSTRAINT [PK_Shift_ShiftID] PRIMARY KEY CLUSTERED
(
[ShiftID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work shift lookup table.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Shift records.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'COLUMN', [ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shift description.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shift start time.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'COLUMN', [StartTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shift end time.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'COLUMN', [EndTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [AK_Shift_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [AK_Shift_StartTime_EndTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [PK_Shift_ShiftID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'CONSTRAINT', [PK_Shift_ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'CONSTRAINT', [DF_Shift_ModifiedDate]; -- (GETDATE())


Purchasing.ShipMethod - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.ShipMethod

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[ShipMethod](
[ShipMethodID] [int] IDENTITY (1, 1) NOT NULL,
[Name] [Name] NOT NULL,
[ShipBase] [money] NOT NULL CONSTRAINT [DF_ShipMethod_ShipBase] DEFAULT (0.00),
[ShipRate] [money] NOT NULL CONSTRAINT [DF_ShipMethod_ShipRate] DEFAULT (0.00),
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_ShipMethod_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ShipMethod_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ShipMethod_ShipBase] CHECK ([ShipBase] > 0.00),
CONSTRAINT [CK_ShipMethod_ShipRate] CHECK ([ShipRate] > 0.00),
) ON [PRIMARY];

ALTER TABLE [Purchasing].[ShipMethod] WITH CHECK ADD
CONSTRAINT [PK_ShipMethod_ShipMethodID] PRIMARY KEY CLUSTERED
(
[ShipMethodID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping company lookup table.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ShipMethod records.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'COLUMN', [ShipMethodID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping company name.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Minimum shipping charge.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'COLUMN', [ShipBase];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shipping charge per pound.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'COLUMN', [ShipRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [AK_ShipMethod_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [AK_ShipMethod_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [PK_ShipMethod_ShipMethodID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [PK_ShipMethod_ShipMethodID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [DF_ShipMethod_ShipBase]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [DF_ShipMethod_ShipRate]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [DF_ShipMethod_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [DF_ShipMethod_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ShipBase]>(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [CK_ShipMethod_ShipBase]; -- ([ShipBase]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ShipRate]>(0.00)', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'CONSTRAINT', [CK_ShipMethod_ShipRate]; -- ([ShipRate]>(0.00))


Sales.ShoppingCartItem - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.ShoppingCartItem

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[ShoppingCartItem](
[ShoppingCartItemID] [int] IDENTITY (1, 1) NOT NULL,
[ShoppingCartID] [nvarchar](50) NOT NULL,
[Quantity] [int] NOT NULL CONSTRAINT [DF_ShoppingCartItem_Quantity] DEFAULT (1),
[ProductID] [int] NOT NULL,
[DateCreated] [datetime] NOT NULL CONSTRAINT [DF_ShoppingCartItem_DateCreated] DEFAULT (GETDATE()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ShoppingCartItem_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_ShoppingCartItem_Quantity] CHECK ([Quantity] >= 1)
) ON [PRIMARY];

ALTER TABLE [Sales].[ShoppingCartItem] WITH CHECK ADD
CONSTRAINT [PK_ShoppingCartItem_ShoppingCartItemID] PRIMARY KEY CLUSTERED
(
[ShoppingCartItemID]
) ON [PRIMARY];

ALTER TABLE [Sales].[ShoppingCartItem] ADD
CONSTRAINT [FK_ShoppingCartItem_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Contains online customer orders until the order is submitted or cancelled.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for ShoppingCartItem records.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'COLUMN', [ShoppingCartItemID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Shopping cart identification number.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'COLUMN', [ShoppingCartID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product quantity ordered.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'COLUMN', [Quantity];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product ordered. Foreign key to Product.ProductID.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date the time the record was created.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'COLUMN', [DateCreated];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'INDEX', [IX_ShoppingCartItem_ShoppingCartID_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'INDEX', [PK_ShoppingCartItem_ShoppingCartItemID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'CONSTRAINT', [PK_ShoppingCartItem_ShoppingCartItemID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'CONSTRAINT', [FK_ShoppingCartItem_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'CONSTRAINT', [DF_ShoppingCartItem_Quantity]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'CONSTRAINT', [DF_ShoppingCartItem_DateCreated]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'CONSTRAINT', [DF_ShoppingCartItem_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [Quantity]>=(1)', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'CONSTRAINT', [CK_ShoppingCartItem_Quantity]; -- ([Quantity]>=(1))


Sales.SpecialOffer - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SpecialOffer

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SpecialOffer](
[SpecialOfferID] [int] IDENTITY (1, 1) NOT NULL,
[Description] [nvarchar](255) NOT NULL,
[DiscountPct] [smallmoney] NOT NULL CONSTRAINT [DF_SpecialOffer_DiscountPct] DEFAULT (0.00),
[Type] [nvarchar](50) NOT NULL,
[Category] [nvarchar](50) NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NOT NULL,
[MinQty] [int] NOT NULL CONSTRAINT [DF_SpecialOffer_MinQty] DEFAULT (0),
[MaxQty] [int] NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SpecialOffer_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SpecialOffer_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_SpecialOffer_EndDate] CHECK ([EndDate] >= [StartDate]),
CONSTRAINT [CK_SpecialOffer_DiscountPct] CHECK ([DiscountPct] >= 0.00),
CONSTRAINT [CK_SpecialOffer_MinQty] CHECK ([MinQty] >= 0),
CONSTRAINT [CK_SpecialOffer_MaxQty] CHECK ([MaxQty] >= 0)
) ON [PRIMARY];

ALTER TABLE [Sales].[SpecialOffer] WITH CHECK ADD
CONSTRAINT [PK_SpecialOffer_SpecialOfferID] PRIMARY KEY CLUSTERED
(
[SpecialOfferID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sale discounts lookup table.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SpecialOffer records.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [SpecialOfferID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Discount description.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [Description];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Discount precentage.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [DiscountPct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Discount type category.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [Type];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Group the discount applies to such as Reseller or Customer.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [Category];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Discount start date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Discount end date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Minimum discount percent allowed.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [MinQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Maximum discount percent allowed.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [MaxQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'INDEX', [AK_SpecialOffer_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'INDEX', [PK_SpecialOffer_SpecialOfferID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [PK_SpecialOffer_SpecialOfferID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [DF_SpecialOffer_DiscountPct]; -- ((0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0.0', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [DF_SpecialOffer_MinQty]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [DF_SpecialOffer_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [DF_SpecialOffer_rowguid]; -- (newid())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [DiscountPct]>=(0.00)', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [CK_SpecialOffer_DiscountPct]; -- ([DiscountPct]>=(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [MaxQty]>=(0)', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [CK_SpecialOffer_MaxQty]; -- ([MaxQty]>=(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [MinQty]>=(0)', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [CK_SpecialOffer_MinQty]; -- ([MinQty]>=(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EndDate] >= [StartDate]', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'CONSTRAINT', [CK_SpecialOffer_EndDate]; -- ([EndDate]>=[StartDate])


Sales.SpecialOfferProduct - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.SpecialOfferProduct

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[SpecialOfferProduct](
[SpecialOfferID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SpecialOfferProduct_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SpecialOfferProduct_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[SpecialOfferProduct] WITH CHECK ADD
CONSTRAINT [PK_SpecialOfferProduct_SpecialOfferID_ProductID] PRIMARY KEY CLUSTERED
(
[SpecialOfferID],
[ProductID]
) ON [PRIMARY];

ALTER TABLE [Sales].[SpecialOfferProduct] ADD
CONSTRAINT [FK_SpecialOfferProduct_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID] FOREIGN KEY
(
[SpecialOfferID]
) REFERENCES [Sales].[SpecialOffer](
[SpecialOfferID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping products to special offer discounts.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for SpecialOfferProduct records.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'COLUMN', [SpecialOfferID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [AK_SpecialOfferProduct_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [IX_SpecialOfferProduct_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [PK_SpecialOfferProduct_SpecialOfferID_ProductID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'CONSTRAINT', [PK_SpecialOfferProduct_SpecialOfferID_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'CONSTRAINT', [FK_SpecialOfferProduct_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SpecialOffer.SpecialOfferID.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'CONSTRAINT', [FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'CONSTRAINT', [DF_SpecialOfferProduct_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'CONSTRAINT', [DF_SpecialOfferProduct_rowguid]; -- (newid())


Person.StateProvince - Source code

Source code SQL 2005 Adventure Works OLTP

Person.StateProvince

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Person].[StateProvince](
[StateProvinceID] [int] IDENTITY (1, 1) NOT NULL,
[StateProvinceCode] [nchar](3) NOT NULL,
[CountryRegionCode] [nvarchar](3) NOT NULL,
[IsOnlyStateProvinceFlag] [Flag] NOT NULL CONSTRAINT [DF_StateProvince_IsOnlyStateProvinceFlag] DEFAULT (1),
[Name] [Name] NOT NULL,
[TerritoryID] [int] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_StateProvince_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_StateProvince_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

GO

ALTER TABLE [Person].[StateProvince] WITH CHECK ADD
CONSTRAINT [PK_StateProvince_StateProvinceID] PRIMARY KEY CLUSTERED
(
[StateProvinceID]
) ON [PRIMARY];

ALTER TABLE [Person].[StateProvince] ADD
CONSTRAINT [FK_StateProvince_CountryRegion_CountryRegionCode] FOREIGN KEY
(
[CountryRegionCode]
) REFERENCES [Person].[CountryRegion](
[CountryRegionCode]
),
CONSTRAINT [FK_StateProvince_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [Sales].[SalesTerritory](
[TerritoryID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'State and province lookup table.', N'SCHEMA', [Person], N'TABLE', [StateProvince], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for StateProvince records.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ISO standard state or province code.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [StateProvinceCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. ', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = StateProvinceCode exists. 1 = StateProvinceCode unavailable, using CountryRegionCode.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [IsOnlyStateProvinceFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'State or province description.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ID of the territory in which the state or province is located. Foreign key to SalesTerritory.SalesTerritoryID.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_StateProvinceCode_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [PK_StateProvince_StateProvinceID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'CONSTRAINT', [PK_StateProvince_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing CountryRegion.CountryRegionCode.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'CONSTRAINT', [FK_StateProvince_CountryRegion_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesTerritory.TerritoryID.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'CONSTRAINT', [FK_StateProvince_SalesTerritory_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1 (TRUE)', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'CONSTRAINT', [DF_StateProvince_IsOnlyStateProvinceFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'CONSTRAINT', [DF_StateProvince_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'CONSTRAINT', [DF_StateProvince_rowguid]; -- (newid())


Sales.Store - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.Store

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[Store](
[CustomerID] [int] NOT NULL,
[Name] [Name] NOT NULL,
[SalesPersonID] [int] NULL,
[Demographics] [XML]([Sales].[StoreSurveySchemaCollection]) NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Store_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Store_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[Store] WITH CHECK ADD
CONSTRAINT [PK_Store_CustomerID] PRIMARY KEY CLUSTERED
(
[CustomerID]
) ON [PRIMARY];

ALTER TABLE [Sales].[Store] ADD
CONSTRAINT [FK_Store_Customer_CustomerID] FOREIGN KEY
(
[CustomerID]
) REFERENCES [Sales].[Customer](
[CustomerID]
),
CONSTRAINT [FK_Store_SalesPerson_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [Sales].[SalesPerson](
[SalesPersonID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Customers (resellers) of Adventure Works products.', N'SCHEMA', [Sales], N'TABLE', [Store], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [Store], N'COLUMN', [CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Name of the store.', N'SCHEMA', [Sales], N'TABLE', [Store], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID.', N'SCHEMA', [Sales], N'TABLE', [Store], N'COLUMN', [SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Demographic informationg about the store such as the number of employees, annual sales and store type.', N'SCHEMA', [Sales], N'TABLE', [Store], N'COLUMN', [Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [Store], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [Store], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [AK_Store_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PK_Store_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [IX_Store_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PXML_Store_Demographics];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [Store], N'CONSTRAINT', [PK_Store_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing SalesPerson.SalesPersonID', N'SCHEMA', [Sales], N'TABLE', [Store], N'CONSTRAINT', [FK_Store_SalesPerson_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [Store], N'CONSTRAINT', [FK_Store_Customer_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [Store], N'CONSTRAINT', [DF_Store_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [Store], N'CONSTRAINT', [DF_Store_rowguid]; -- (newid())


Sales.StoreContact - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.StoreContact

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Sales].[StoreContact](
[CustomerID] [int] NOT NULL,
[ContactID] [int] NOT NULL,
[ContactTypeID] [int] NOT NULL,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_StoreContact_rowguid] DEFAULT (NEWID()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_StoreContact_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Sales].[StoreContact] WITH CHECK ADD
CONSTRAINT [PK_StoreContact_CustomerID_ContactID] PRIMARY KEY CLUSTERED
(
[CustomerID],
[ContactID]
) ON [PRIMARY];

ALTER TABLE [Sales].[StoreContact] ADD
CONSTRAINT [FK_StoreContact_Contact_ContactID] FOREIGN KEY
(
[ContactID]
) REFERENCES [Person].[Contact](
[ContactID]
),
CONSTRAINT [FK_StoreContact_ContactType_ContactTypeID] FOREIGN KEY
(
[ContactTypeID]
) REFERENCES [Person].[ContactType](
[ContactTypeID]
),
CONSTRAINT [FK_StoreContact_Store_CustomerID] FOREIGN KEY
(
[CustomerID]
) REFERENCES [Sales].[Store](
[CustomerID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping stores and their employees.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Store identification number. Foreign key to Customer.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'COLUMN', [CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Contact (store employee) identification number. Foreign key to Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Contact type such as owner or purchasing agent. Foreign key to ContactType.ContactTypeID.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'COLUMN', [ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'COLUMN', [rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [AK_StoreContact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [PK_StoreContact_CustomerID_ContactID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'CONSTRAINT', [PK_StoreContact_CustomerID_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Contact.ContactID.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'CONSTRAINT', [FK_StoreContact_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ContactType.ContactTypeID.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'CONSTRAINT', [FK_StoreContact_ContactType_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Store.CustomerID.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'CONSTRAINT', [FK_StoreContact_Store_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'CONSTRAINT', [DF_StoreContact_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of NEWID()', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'CONSTRAINT', [DF_StoreContact_rowguid]; -- (newid())


Production.TransactionHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.TransactionHistory

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[TransactionHistory](
[TransactionID] [int] IDENTITY (1, 1) NOT NULL,
[ProductID] [int] NOT NULL,
[ReferenceOrderID] [int] NOT NULL,
[ReferenceOrderLineID] [int] NOT NULL CONSTRAINT [DF_TransactionHistory_ReferenceOrderLineID] DEFAULT (0),
[TransactionDate] [datetime] NOT NULL CONSTRAINT [DF_TransactionHistory_TransactionDate] DEFAULT (GETDATE()),
[TransactionType] [nchar](1) NOT NULL,
[Quantity] [int] NOT NULL,
[ActualCost] [money] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_TransactionHistory_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_TransactionHistory_TransactionType] CHECK (UPPER([TransactionType]) IN ('W', 'S', 'P'))
) ON [PRIMARY];

ALTER TABLE [Production].[TransactionHistory] WITH CHECK ADD
CONSTRAINT [PK_TransactionHistory_TransactionID] PRIMARY KEY CLUSTERED
(
[TransactionID]
) ON [PRIMARY];

ALTER TABLE [Production].[TransactionHistory] ADD
CONSTRAINT [FK_TransactionHistory_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Record of each purchase order, sales order, or work order transaction year to date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for TransactionHistory records.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [TransactionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Purchase order, sales order, or work order identification number.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [ReferenceOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Line number associated with the purchase order, sales order, or work order.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time of the transaction.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [TransactionDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'W = WorkOrder, S = SalesOrder, P = PurchaseOrder', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [TransactionType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product quantity.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [Quantity];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product cost.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [ActualCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [IX_TransactionHistory_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [PK_TransactionHistory_TransactionID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'CONSTRAINT', [PK_TransactionHistory_TransactionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'CONSTRAINT', [FK_TransactionHistory_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'CONSTRAINT', [DF_TransactionHistory_ReferenceOrderLineID]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'CONSTRAINT', [DF_TransactionHistory_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'CONSTRAINT', [DF_TransactionHistory_TransactionDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [TransactionType]=''p'' OR [TransactionType]=''s'' OR [TransactionType]=''w'' OR [TransactionType]=''P'' OR [TransactionType]=''S'' OR [TransactionType]=''W'')', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'CONSTRAINT', [CK_TransactionHistory_TransactionType]; -- (UPPER([TransactionType])='P' OR UPPER([TransactionType])='S' OR UPPER([TransactionType])='W')


Production.TransactionHistoryArchive - Source code

Source code SQL 2005 Adventure Works OLTP

Production.TransactionHistoryArchive

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[TransactionHistoryArchive](
[TransactionID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[ReferenceOrderID] [int] NOT NULL,
[ReferenceOrderLineID] [int] NOT NULL CONSTRAINT [DF_TransactionHistoryArchive_ReferenceOrderLineID] DEFAULT (0),
[TransactionDate] [datetime] NOT NULL CONSTRAINT [DF_TransactionHistoryArchive_TransactionDate] DEFAULT (GETDATE()),
[TransactionType] [nchar](1) NOT NULL,
[Quantity] [int] NOT NULL,
[ActualCost] [money] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_TransactionHistoryArchive_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_TransactionHistoryArchive_TransactionType] CHECK (UPPER([TransactionType]) IN ('W', 'S', 'P'))
) ON [PRIMARY];

ALTER TABLE [Production].[TransactionHistoryArchive] WITH CHECK ADD
CONSTRAINT [PK_TransactionHistoryArchive_TransactionID] PRIMARY KEY CLUSTERED
(
[TransactionID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Transactions for previous years.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for TransactionHistoryArchive records.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [TransactionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Purchase order, sales order, or work order identification number.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [ReferenceOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Line number associated with the purchase order, sales order, or work order.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time of the transaction.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [TransactionDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'W = Work Order, S = Sales Order, P = Purchase Order', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [TransactionType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product quantity.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [Quantity];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product cost.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [ActualCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [IX_TransactionHistoryArchive_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [PK_TransactionHistoryArchive_TransactionID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'CONSTRAINT', [PK_TransactionHistoryArchive_TransactionID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 0', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'CONSTRAINT', [DF_TransactionHistoryArchive_ReferenceOrderLineID]; -- ((0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'CONSTRAINT', [DF_TransactionHistoryArchive_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'CONSTRAINT', [DF_TransactionHistoryArchive_TransactionDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [TransactionType]=''p'' OR [TransactionType]=''s'' OR [TransactionType]=''w'' OR [TransactionType]=''P'' OR [TransactionType]=''S'' OR [TransactionType]=''W''', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'CONSTRAINT', [CK_TransactionHistoryArchive_TransactionType]; -- (UPPER([TransactionType])='P' OR UPPER([TransactionType])='S' OR UPPER([TransactionType])='W')


Production.UnitMeasure - Source code

Source code SQL 2005 Adventure Works OLTP

Production.UnitMeasure

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[UnitMeasure](
[UnitMeasureCode] [nchar](3) NOT NULL,
[Name] [Name] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_UnitMeasure_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Production].[UnitMeasure] WITH CHECK ADD
CONSTRAINT [PK_UnitMeasure_UnitMeasureCode] PRIMARY KEY CLUSTERED
(
[UnitMeasureCode]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unit of measure lookup table.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'COLUMN', [UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unit of measure description.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'INDEX', [AK_UnitMeasure_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'INDEX', [PK_UnitMeasure_UnitMeasureCode];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'CONSTRAINT', [PK_UnitMeasure_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'CONSTRAINT', [DF_UnitMeasure_ModifiedDate]; -- (GETDATE())


Purchasing.Vendor - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.Vendor

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[Vendor](
[VendorID] [int] IDENTITY (1, 1) NOT NULL,
[AccountNumber] [AccountNumber] NOT NULL,
[Name] [Name] NOT NULL,
[CreditRating] [tinyint] NOT NULL,
[PreferredVendorStatus] [Flag] NOT NULL CONSTRAINT [DF_Vendor_PreferredVendorStatus] DEFAULT (1),
[ActiveFlag] [Flag] NOT NULL CONSTRAINT [DF_Vendor_ActiveFlag] DEFAULT (1),
[PurchasingWebServiceURL] [nvarchar](1024) NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Vendor_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_Vendor_CreditRating] CHECK ([CreditRating] BETWEEN 1 AND 5)
) ON [PRIMARY];

ALTER TABLE [Purchasing].[Vendor] WITH CHECK ADD
CONSTRAINT [PK_Vendor_VendorID] PRIMARY KEY CLUSTERED
(
[VendorID]
) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Companies from whom Adventure Works Cycles purchases parts or other goods.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for Vendor records.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor account (identification) number.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Company name.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [CreditRating];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [PreferredVendorStatus];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'0 = Vendor no longer used. 1 = Vendor is actively used.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [ActiveFlag];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor URL.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [PurchasingWebServiceURL];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'INDEX', [AK_Vendor_AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'INDEX', [PK_Vendor_VendorID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'CONSTRAINT', [PK_Vendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1 (TRUE)', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'CONSTRAINT', [DF_Vendor_ActiveFlag]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of 1 (TRUE)', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'CONSTRAINT', [DF_Vendor_PreferredVendorStatus]; -- ((1))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'CONSTRAINT', [DF_Vendor_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [CreditRating] BETWEEN (1) AND (5)', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'CONSTRAINT', [CK_Vendor_CreditRating]; -- ([CreditRating]>=(1) AND [CreditRating]<=(5))


Purchasing.VendorAddress - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.VendorAddress

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[VendorAddress](
[VendorID] [int] NOT NULL,
[AddressID] [int] NOT NULL,
[AddressTypeID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_VendorAddress_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Purchasing].[VendorAddress] WITH CHECK ADD
CONSTRAINT [PK_VendorAddress_VendorID_AddressID] PRIMARY KEY CLUSTERED
(
[VendorID],
[AddressID]
) ON [PRIMARY];

ALTER TABLE [Purchasing].[VendorAddress] ADD
CONSTRAINT [FK_VendorAddress_Address_AddressID] FOREIGN KEY
(
[AddressID]
) REFERENCES [Person].[Address](
[AddressID]
),
CONSTRAINT [FK_VendorAddress_AddressType_AddressTypeID] FOREIGN KEY
(
[AddressTypeID]
) REFERENCES [Person].[AddressType](
[AddressTypeID]
),
CONSTRAINT [FK_VendorAddress_Vendor_VendorID] FOREIGN KEY
(
[VendorID]
) REFERENCES [Purchasing].[Vendor](
[VendorID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference mapping vendors and addresses.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'COLUMN', [VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Address.AddressID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'COLUMN', [AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Address type. Foreign key to AddressType.AddressTypeID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'COLUMN', [AddressTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'INDEX', [IX_VendorAddress_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'INDEX', [PK_VendorAddress_VendorID_AddressID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'CONSTRAINT', [PK_VendorAddress_VendorID_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Address.AddressID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'CONSTRAINT', [FK_VendorAddress_Address_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing AddressType.AddressTypeID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'CONSTRAINT', [FK_VendorAddress_AddressType_AddressTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'CONSTRAINT', [FK_VendorAddress_Vendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'CONSTRAINT', [DF_VendorAddress_ModifiedDate]; -- (GETDATE())


Purchasing.VendorContact - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.VendorContact

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Purchasing].[VendorContact](
[VendorID] [int] NOT NULL,
[ContactID] [int] NOT NULL,
[ContactTypeID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_VendorContact_ModifiedDate] DEFAULT (GETDATE())
) ON [PRIMARY];

ALTER TABLE [Purchasing].[VendorContact] WITH CHECK ADD
CONSTRAINT [PK_VendorContact_VendorID_ContactID] PRIMARY KEY CLUSTERED
(
[VendorID],
[ContactID]
) ON [PRIMARY];

ALTER TABLE [Purchasing].[VendorContact] ADD
CONSTRAINT [FK_VendorContact_Contact_ContactID] FOREIGN KEY
(
[ContactID]
) REFERENCES [Person].[Contact](
[ContactID]
),
CONSTRAINT [FK_VendorContact_ContactType_ContactTypeID] FOREIGN KEY
(
[ContactTypeID]
) REFERENCES [Person].[ContactType](
[ContactTypeID]
),
CONSTRAINT [FK_VendorContact_Vendor_VendorID] FOREIGN KEY
(
[VendorID]
) REFERENCES [Purchasing].[Vendor](
[VendorID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Cross-reference table mapping vendors and their employees.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'COLUMN', [VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Contact (Vendor employee) identification number. Foreign key to Contact.ContactID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'COLUMN', [ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Contact type such as sales manager, or sales agent.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'COLUMN', [ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [IX_VendorContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [IX_VendorContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [PK_VendorContact_VendorID_ContactID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'CONSTRAINT', [PK_VendorContact_VendorID_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Contact.ContactID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'CONSTRAINT', [FK_VendorContact_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ContactType.ContactTypeID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'CONSTRAINT', [FK_VendorContact_ContactType_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Vendor.VendorID.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'CONSTRAINT', [FK_VendorContact_Vendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'CONSTRAINT', [DF_VendorContact_ModifiedDate]; -- (GETDATE())


Production.WorkOrder - Source code

Source code SQL 2005 Adventure Works OLTP

Production.WorkOrder

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[WorkOrder](
[WorkOrderID] [int] IDENTITY (1, 1) NOT NULL,
[ProductID] [int] NOT NULL,
[OrderQty] [int] NOT NULL,
[StockedQty] AS ISNULL([OrderQty] - [ScrappedQty], 0),
[ScrappedQty] [smallint] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[DueDate] [datetime] NOT NULL,
[ScrapReasonID] [smallint] NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_WorkOrder_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_WorkOrder_OrderQty] CHECK ([OrderQty] > 0),
CONSTRAINT [CK_WorkOrder_ScrappedQty] CHECK ([ScrappedQty] >= 0),
CONSTRAINT [CK_WorkOrder_EndDate] CHECK (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL))
) ON [PRIMARY];

ALTER TABLE [Production].[WorkOrder] WITH CHECK ADD
CONSTRAINT [PK_WorkOrder_WorkOrderID] PRIMARY KEY CLUSTERED
(
[WorkOrderID]
) ON [PRIMARY];

ALTER TABLE [Production].[WorkOrder] ADD
CONSTRAINT [FK_WorkOrder_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Production].[Product](
[ProductID]
),
CONSTRAINT [FK_WorkOrder_ScrapReason_ScrapReasonID] FOREIGN KEY
(
[ScrapReasonID]
) REFERENCES [Production].[ScrapReason](
[ScrapReasonID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Manufacturing work orders.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key for WorkOrder records.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [WorkOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product quantity to build.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [OrderQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity built and put in inventory.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [StockedQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Quantity that failed inspection.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [ScrappedQty];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work order start date.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work order end date.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [EndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work order due date.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [DueDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Reason for inspection failure.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [IX_WorkOrder_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [IX_WorkOrder_ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [PK_WorkOrder_WorkOrderID];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [PK_WorkOrder_WorkOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [FK_WorkOrder_Product_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing ScrapReason.ScrapReasonID.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [FK_WorkOrder_ScrapReason_ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [DF_WorkOrder_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [OrderQty]>(0)', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [CK_WorkOrder_OrderQty]; -- ([OrderQty]>(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ScrappedQty]>=(0)', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [CK_WorkOrder_ScrappedQty]; -- ([ScrappedQty]>=(0))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'CONSTRAINT', [CK_WorkOrder_EndDate]; -- ([EndDate]>=[StartDate] OR [EndDate] IS NULL)


Production.WorkOrderRouting - Source code

Source code SQL 2005 Adventure Works OLTP

Production.WorkOrderRouting

Summary listing Bookmark Print Locate in contents

CREATE TABLE [Production].[WorkOrderRouting](
[WorkOrderID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[OperationSequence] [smallint] NOT NULL,
[LocationID] [smallint] NOT NULL,
[ScheduledStartDate] [datetime] NOT NULL,
[ScheduledEndDate] [datetime] NOT NULL,
[ActualStartDate] [datetime] NULL,
[ActualEndDate] [datetime] NULL,
[ActualResourceHrs] [decimal](9, 4) NULL,
[PlannedCost] [money] NOT NULL,
[ActualCost] [money] NULL,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_WorkOrderRouting_ModifiedDate] DEFAULT (GETDATE()),
CONSTRAINT [CK_WorkOrderRouting_ScheduledEndDate] CHECK ([ScheduledEndDate] >= [ScheduledStartDate]),
CONSTRAINT [CK_WorkOrderRouting_ActualEndDate] CHECK (([ActualEndDate] >= [ActualStartDate])
OR ([ActualEndDate] IS NULL) OR ([ActualStartDate] IS NULL)),
CONSTRAINT [CK_WorkOrderRouting_ActualResourceHrs] CHECK ([ActualResourceHrs] >= 0.0000),
CONSTRAINT [CK_WorkOrderRouting_PlannedCost] CHECK ([PlannedCost] > 0.00),
CONSTRAINT [CK_WorkOrderRouting_ActualCost] CHECK ([ActualCost] > 0.00)
) ON [PRIMARY];

ALTER TABLE [Production].[WorkOrderRouting] WITH CHECK ADD
CONSTRAINT [PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence] PRIMARY KEY CLUSTERED
(
[WorkOrderID],
[ProductID],
[OperationSequence]
) ON [PRIMARY];

ALTER TABLE [Production].[WorkOrderRouting] ADD
CONSTRAINT [FK_WorkOrderRouting_Location_LocationID] FOREIGN KEY
(
[LocationID]
) REFERENCES [Production].[Location](
[LocationID]
),
CONSTRAINT [FK_WorkOrderRouting_WorkOrder_WorkOrderID] FOREIGN KEY
(
[WorkOrderID]
) REFERENCES [Production].[WorkOrder](
[WorkOrderID]
);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Work order details.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to WorkOrder.WorkOrderID.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [WorkOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Foreign key to Product.ProductID.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key. Indicates the manufacturing process sequence.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [OperationSequence];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Manufacturing location where the part is processed. Foreign key to Location.LocationID.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Planned manufacturing start date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ScheduledStartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Planned manufacturing end date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ScheduledEndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Actual start date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ActualStartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Actual end date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ActualEndDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Number of manufacturing hours used.>', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ActualResourceHrs];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Estimated manufacturing cost.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [PlannedCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Actual manufacturing cost.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ActualCost];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Date and time the record was last updated.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'COLUMN', [ModifiedDate];

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'INDEX', [IX_WorkOrderRouting_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'INDEX', [PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary key (clustered) constraint', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing Location.LocationID.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [FK_WorkOrderRouting_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Foreign key constraint referencing WorkOrder.WorkOrderID.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [FK_WorkOrderRouting_WorkOrder_WorkOrderID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Default constraint value of GETDATE()', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [DF_WorkOrderRouting_ModifiedDate]; -- (GETDATE())
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ActualCost]>(0.00)', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [CK_WorkOrderRouting_ActualCost]; -- ([ActualCost]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ActualResourceHrs]>=(0.0000)', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [CK_WorkOrderRouting_ActualResourceHrs]; -- ([ActualResourceHrs]>=(0.0000))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [PlannedCost]>(0.00)', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [CK_WorkOrderRouting_PlannedCost]; -- ([PlannedCost]>(0.00))
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ActualEndDate] >= [ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [CK_WorkOrderRouting_ActualEndDate]; -- ([ActualEndDate]>=[ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL)
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Check constraint [ScheduledEndDate] >= [ScheduledStartDate]', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'CONSTRAINT', [CK_WorkOrderRouting_ScheduledEndDate]; -- ([ScheduledEndDate]>=[ScheduledStartDate])


ddlDatabaseTriggerLog - Source code

Source code SQL 2005 Adventure Works OLTP

ddlDatabaseTriggerLog

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [ddlDatabaseTriggerLog]
ON DATABASE
FOR DDL_DATABASE_LEVEL_EVENTS
AS
BEGIN
SET NOCOUNT ON;

DECLARE @data XML;
DECLARE @schema sysname;
DECLARE @object sysname;
DECLARE @eventType sysname;

SET @data = EVENTDATA();
SET @eventType = @data.value('(/EVENT_INSTANCE/EventType)[1]', 'sysname');
SET @schema = @data.value('(/EVENT_INSTANCE/SchemaName)[1]', 'sysname');
SET @object = @data.value('(/EVENT_INSTANCE/ObjectName)[1]', 'sysname')

IF @object IS NOT NULL
PRINT ' ' + @eventType + ' - ' + @schema + '.' + @object;
ELSE
PRINT ' ' + @eventType + ' - ' + @schema;

IF @eventType IS NULL
PRINT CONVERT(nvarchar(max), @data);

INSERT [dbo].[DatabaseLog]
(
[PostTime],
[DatabaseUser],
[Event],
[Schema],
[Object],
[TSQL],
[XmlEvent]
)
VALUES
(
GETDATE(),
CONVERT(sysname, CURRENT_USER),
@eventType,
CONVERT(sysname, @schema),
CONVERT(sysname, @object),
@data.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'nvarchar(max)'),
@data
);
END;


Person.uAddress - Source code

Source code SQL 2005 Adventure Works OLTP

Person.uAddress

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Person].[uAddress] ON [Person].[Address]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Person].[Address]
SET [Person].[Address].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[AddressID] = [Person].[Address].[AddressID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Person.uAddressType - Source code

Source code SQL 2005 Adventure Works OLTP

Person.uAddressType

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Person].[uAddressType] ON [Person].[AddressType]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Person].[AddressType]
SET [Person].[AddressType].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[AddressTypeID] = [Person].[AddressType].[AddressTypeID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


dbo.uAWBuildVersion - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.uAWBuildVersion

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [dbo].[uAWBuildVersion] ON [dbo].[AWBuildVersion]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [dbo].[AWBuildVersion]
SET [dbo].[AWBuildVersion].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SystemInformationID] = [dbo].[AWBuildVersion].[SystemInformationID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uBillOfMaterials - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uBillOfMaterials

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uBillOfMaterials] ON [Production].[BillOfMaterials]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[BillOfMaterials]
SET [Production].[BillOfMaterials].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[BillOfMaterialsID] = [Production].[BillOfMaterials].[BillOfMaterialsID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Person.uContact - Source code

Source code SQL 2005 Adventure Works OLTP

Person.uContact

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Person].[uContact] ON [Person].[Contact]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Person].[Contact]
SET [Person].[Contact].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ContactID] = [Person].[Contact].[ContactID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uContactCreditCard - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uContactCreditCard

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uContactCreditCard] ON [Sales].[ContactCreditCard]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[ContactCreditCard]
SET [Sales].[ContactCreditCard].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ContactID] = [Sales].[ContactCreditCard].[ContactID]
AND inserted.[CreditCardID] = [Sales].[ContactCreditCard].[CreditCardID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Person.uContactType - Source code

Source code SQL 2005 Adventure Works OLTP

Person.uContactType

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Person].[uContactType] ON [Person].[ContactType]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Person].[ContactType]
SET [Person].[ContactType].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ContactTypeID] = [Person].[ContactType].[ContactTypeID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uCountryRegionCurrency - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uCountryRegionCurrency

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uCountryRegionCurrency] ON [Sales].[CountryRegionCurrency]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[CountryRegionCurrency]
SET [Sales].[CountryRegionCurrency].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CountryRegionCode] = [Sales].[CountryRegionCurrency].[CountryRegionCode]
AND inserted.[CurrencyCode] = [Sales].[CountryRegionCurrency].[CurrencyCode];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Person.uCountryRegion - Source code

Source code SQL 2005 Adventure Works OLTP

Person.uCountryRegion

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Person].[uCountryRegion] ON [Person].[CountryRegion]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Person].[CountryRegion]
SET [Person].[CountryRegion].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CountryRegionCode] = [Person].[CountryRegion].[CountryRegionCode];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uCreditCard - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uCreditCard

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uCreditCard] ON [Sales].[CreditCard]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[CreditCard]
SET [Sales].[CreditCard].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CreditCardID] = [Sales].[CreditCard].[CreditCardID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uCulture - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uCulture

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uCulture] ON [Production].[Culture]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[Culture]
SET [Production].[Culture].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CultureID] = [Production].[Culture].[CultureID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uCurrency - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uCurrency

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uCurrency] ON [Sales].[Currency]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[Currency]
SET [Sales].[Currency].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CurrencyCode] = [Sales].[Currency].[CurrencyCode];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uCurrencyRate - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uCurrencyRate

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uCurrencyRate] ON [Sales].[CurrencyRate]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[CurrencyRate]
SET [Sales].[CurrencyRate].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CurrencyRateID] = [Sales].[CurrencyRate].[CurrencyRateID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uCustomer - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uCustomer

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uCustomer] ON [Sales].[Customer]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[Customer]
SET [Sales].[Customer].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CustomerID] = [Sales].[Customer].[CustomerID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uCustomerAddress - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uCustomerAddress

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uCustomerAddress] ON [Sales].[CustomerAddress]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[CustomerAddress]
SET [Sales].[CustomerAddress].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CustomerID] = [Sales].[CustomerAddress].[CustomerID]
AND inserted.[AddressID] = [Sales].[CustomerAddress].[AddressID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uDepartment - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uDepartment

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uDepartment] ON [HumanResources].[Department]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[Department]
SET [HumanResources].[Department].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[DepartmentID] = [HumanResources].[Department].[DepartmentID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uDocument - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uDocument

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uDocument] ON [Production].[Document]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[Document]
SET [Production].[Document].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[DocumentID] = [Production].[Document].[DocumentID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.dEmployee - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.dEmployee

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[dEmployee] ON [HumanResources].[Employee]
INSTEAD OF DELETE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

DECLARE @DeleteCount int;

SELECT @DeleteCount = COUNT(*) FROM deleted;
IF @DeleteCount > 0
BEGIN
RAISERROR
(N'Employees cannot be deleted. They can only be marked as not current.', -- Message
10, -- Severity.
1); -- State.

ROLLBACK TRANSACTION;
RETURN;
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uEmployee - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uEmployee

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uEmployee] ON [HumanResources].[Employee]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[Employee]
SET [HumanResources].[Employee].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[EmployeeID] = [HumanResources].[Employee].[EmployeeID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uEmployeeAddress - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uEmployeeAddress

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uEmployeeAddress] ON [HumanResources].[EmployeeAddress]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[EmployeeAddress]
SET [HumanResources].[EmployeeAddress].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[EmployeeID] = [HumanResources].[EmployeeAddress].[EmployeeID]
AND inserted.[AddressID] = [HumanResources].[EmployeeAddress].[AddressID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uEmployeeDepartmentHistory - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uEmployeeDepartmentHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uEmployeeDepartmentHistory] ON [HumanResources].[EmployeeDepartmentHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[EmployeeDepartmentHistory]
SET [HumanResources].[EmployeeDepartmentHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[EmployeeID] = [HumanResources].[EmployeeDepartmentHistory].[EmployeeID]
AND inserted.[DepartmentID] = [HumanResources].[EmployeeDepartmentHistory].[DepartmentID]
AND inserted.[StartDate] = [HumanResources].[EmployeeDepartmentHistory].[StartDate]
AND inserted.[ShiftID] = [HumanResources].[EmployeeDepartmentHistory].[ShiftID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uEmployeePayHistory - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uEmployeePayHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uEmployeePayHistory] ON [HumanResources].[EmployeePayHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[EmployeePayHistory]
SET [HumanResources].[EmployeePayHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[EmployeeID] = [HumanResources].[EmployeePayHistory].[EmployeeID]
AND inserted.[RateChangeDate] = [HumanResources].[EmployeePayHistory].[RateChangeDate];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uIllustration - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uIllustration

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uIllustration] ON [Production].[Illustration]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[Illustration]
SET [Production].[Illustration].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[IllustrationID] = [Production].[Illustration].[IllustrationID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.iuIndividual - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.iuIndividual

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[iuIndividual] ON [Sales].[Individual]
AFTER INSERT, UPDATE NOT FOR REPLICATION
AS
BEGIN
SET NOCOUNT ON;

-- Only allow the Customer to be a Store OR Individual
IF EXISTS (SELECT * FROM inserted INNER JOIN [Sales].[Store]
ON inserted.[CustomerID] = [Sales].[Store].[CustomerID])
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

IF UPDATE([CustomerID]) OR UPDATE([Demographics])
BEGIN
UPDATE [Sales].[Individual]
SET [Sales].[Individual].[Demographics] = N'<IndividualSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey">
<TotalPurchaseYTD>0.00</TotalPurchaseYTD>
</IndividualSurvey>'
FROM inserted
WHERE [Sales].[Individual].[CustomerID] = inserted.[CustomerID]
AND inserted.[Demographics] IS NULL;

UPDATE [Sales].[Individual]
SET [Demographics].modify(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
insert <TotalPurchaseYTD>0.00</TotalPurchaseYTD>
as first
into (/IndividualSurvey)[1]')
FROM inserted
WHERE [Sales].[Individual].[CustomerID] = inserted.[CustomerID]
AND inserted.[Demographics] IS NOT NULL
AND inserted.[Demographics].exist(N'declare default element namespace
"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
/IndividualSurvey/TotalPurchaseYTD') <> 1;
END;

UPDATE [Sales].[Individual]
SET [Sales].[Individual].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CustomerID] = [Sales].[Individual].[CustomerID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uJobCandidate - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uJobCandidate

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uJobCandidate] ON [HumanResources].[JobCandidate]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[JobCandidate]
SET [HumanResources].[JobCandidate].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[JobCandidateID] = [HumanResources].[JobCandidate].[JobCandidateID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uLocation - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uLocation

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uLocation] ON [Production].[Location]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[Location]
SET [Production].[Location].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[LocationID] = [Production].[Location].[LocationID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProduct - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProduct

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProduct] ON [Production].[Product]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[Product]
SET [Production].[Product].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Production].[Product].[ProductID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductCategory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductCategory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductCategory] ON [Production].[ProductCategory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductCategory]
SET [Production].[ProductCategory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductCategoryID] = [Production].[ProductCategory].[ProductCategoryID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductCostHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductCostHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductCostHistory] ON [Production].[ProductCostHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductCostHistory]
SET [Production].[ProductCostHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Production].[ProductCostHistory].[ProductID]
AND inserted.[StartDate] = [Production].[ProductCostHistory].[StartDate];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductDescription - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductDescription

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductDescription] ON [Production].[ProductDescription]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductDescription]
SET [Production].[ProductDescription].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductDescriptionID] = [Production].[ProductDescription].[ProductDescriptionID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductDocument - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductDocument

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductDocument] ON [Production].[ProductDocument]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductDocument]
SET [Production].[ProductDocument].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Production].[ProductDocument].[ProductID]
AND inserted.[DocumentID] = [Production].[ProductDocument].[DocumentID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductInventory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductInventory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductInventory] ON [Production].[ProductInventory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductInventory]
SET [Production].[ProductInventory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Production].[ProductInventory].[ProductID]
AND inserted.[LocationID] = [Production].[ProductInventory].[LocationID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductListPriceHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductListPriceHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductListPriceHistory] ON [Production].[ProductListPriceHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductListPriceHistory]
SET [Production].[ProductListPriceHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Production].[ProductListPriceHistory].[ProductID]
AND inserted.[StartDate] = [Production].[ProductListPriceHistory].[StartDate];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductModel - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductModel

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductModel] ON [Production].[ProductModel]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductModel]
SET [Production].[ProductModel].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductModelID] = [Production].[ProductModel].[ProductModelID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductModelIllustration - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductModelIllustration

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductModelIllustration] ON [Production].[ProductModelIllustration]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductModelIllustration]
SET [Production].[ProductModelIllustration].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductModelID] = [Production].[ProductModelIllustration].[ProductModelID]
AND inserted.[IllustrationID] = [Production].[ProductModelIllustration].[IllustrationID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductModelProductDescriptionCulture - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductModelProductDescriptionCulture

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductModelProductDescriptionCulture] ON [Production].[ProductModelProductDescriptionCulture]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductModelProductDescriptionCulture]
SET [Production].[ProductModelProductDescriptionCulture].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductModelID] = [Production].[ProductModelProductDescriptionCulture].[ProductModelID]
AND inserted.[ProductDescriptionID] = [Production].[ProductModelProductDescriptionCulture].[ProductDescriptionID]
AND inserted.[CultureID] = [Production].[ProductModelProductDescriptionCulture].[CultureID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductPhoto - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductPhoto

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductPhoto] ON [Production].[ProductPhoto]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductPhoto]
SET [Production].[ProductPhoto].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductPhotoID] = [Production].[ProductPhoto].[ProductPhotoID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductProductPhoto - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductProductPhoto

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductProductPhoto] ON [Production].[ProductProductPhoto]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductProductPhoto]
SET [Production].[ProductProductPhoto].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Production].[ProductProductPhoto].[ProductID]
AND inserted.[ProductPhotoID] = [Production].[ProductProductPhoto].[ProductPhotoID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductReview - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductReview

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductReview] ON [Production].[ProductReview]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductReview]
SET [Production].[ProductReview].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductReviewID] = [Production].[ProductReview].[ProductReviewID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uProductSubcategory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uProductSubcategory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uProductSubcategory] ON [Production].[ProductSubcategory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ProductSubcategory]
SET [Production].[ProductSubcategory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductSubcategoryID] = [Production].[ProductSubcategory].[ProductSubcategoryID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uProductVendor - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uProductVendor

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uProductVendor] ON [Purchasing].[ProductVendor]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Purchasing].[ProductVendor]
SET [Purchasing].[ProductVendor].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ProductID] = [Purchasing].[ProductVendor].[ProductID]
AND inserted.[VendorID] = [Purchasing].[ProductVendor].[VendorID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.iPurchaseOrderDetail - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.iPurchaseOrderDetail

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[iPurchaseOrderDetail] ON [Purchasing].[PurchaseOrderDetail]
AFTER INSERT AS
BEGIN
SET NOCOUNT ON;

INSERT INTO [Production].[TransactionHistory]
([ProductID]
,[ReferenceOrderID]
,[ReferenceOrderLineID]
,[TransactionType]
,[TransactionDate]
,[Quantity]
,[ActualCost])
SELECT
inserted.[ProductID]
,inserted.[PurchaseOrderID]
,inserted.[PurchaseOrderDetailID]
,'P'
,GETDATE()
,inserted.[OrderQty]
,inserted.[UnitPrice]
FROM inserted
INNER JOIN [Purchasing].[PurchaseOrderHeader]
ON inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID];

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

-- Update SubTotal in PurchaseOrderHeader record. Note that this causes the
-- PurchaseOrderHeader trigger to fire which will update the RevisionNumber.
UPDATE [Purchasing].[PurchaseOrderHeader]
SET [Purchasing].[PurchaseOrderHeader].[SubTotal] =
(SELECT SUM([Purchasing].[PurchaseOrderDetail].[LineTotal])
FROM [Purchasing].[PurchaseOrderDetail]
WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID])
WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] IN (SELECT inserted.[PurchaseOrderID] FROM inserted);

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uPurchaseOrderDetail - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uPurchaseOrderDetail

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uPurchaseOrderDetail] ON [Purchasing].[PurchaseOrderDetail]
AFTER UPDATE AS
BEGIN
SET NOCOUNT ON;

IF UPDATE([ProductID]) OR UPDATE([OrderQty]) OR UPDATE([UnitPrice])
-- Insert record into TransactionHistory
BEGIN
INSERT INTO [Production].[TransactionHistory]
([ProductID]
,[ReferenceOrderID]
,[ReferenceOrderLineID]
,[TransactionType]
,[TransactionDate]
,[Quantity]
,[ActualCost])
SELECT
inserted.[ProductID]
,inserted.[PurchaseOrderID]
,inserted.[PurchaseOrderDetailID]
,'P'
,GETDATE()
,inserted.[OrderQty]
,inserted.[UnitPrice]
FROM inserted
INNER JOIN [Purchasing].[PurchaseOrderDetail]
ON inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID];

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

-- Update SubTotal in PurchaseOrderHeader record. Note that this causes the
-- PurchaseOrderHeader trigger to fire which will update the RevisionNumber.
UPDATE [Purchasing].[PurchaseOrderHeader]
SET [Purchasing].[PurchaseOrderHeader].[SubTotal] =
(SELECT SUM([Purchasing].[PurchaseOrderDetail].[LineTotal])
FROM [Purchasing].[PurchaseOrderDetail]
WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID]
= [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID])
WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID]
IN (SELECT inserted.[PurchaseOrderID] FROM inserted);

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

UPDATE [Purchasing].[PurchaseOrderDetail]
SET [Purchasing].[PurchaseOrderDetail].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderID]
AND inserted.[PurchaseOrderDetailID] = [Purchasing].[PurchaseOrderDetail].[PurchaseOrderDetailID];
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uPurchaseOrderHeader - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uPurchaseOrderHeader

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uPurchaseOrderHeader] ON [Purchasing].[PurchaseOrderHeader]
AFTER UPDATE AS
BEGIN
SET NOCOUNT ON;

-- Update RevisionNumber for modification of any field EXCEPT the Status.
IF NOT UPDATE([Status])
BEGIN
UPDATE [Purchasing].[PurchaseOrderHeader]
SET [Purchasing].[PurchaseOrderHeader].[RevisionNumber] =
[Purchasing].[PurchaseOrderHeader].[RevisionNumber] + 1
WHERE [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID] IN
(SELECT inserted.[PurchaseOrderID] FROM inserted);

IF (@@ERROR <>0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

UPDATE [Purchasing].[PurchaseOrderHeader]
SET [Purchasing].[PurchaseOrderHeader].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[PurchaseOrderID] = [Purchasing].[PurchaseOrderHeader].[PurchaseOrderID];
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.iduSalesOrderDetail - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.iduSalesOrderDetail

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[iduSalesOrderDetail] ON [Sales].[SalesOrderDetail]
AFTER INSERT, DELETE, UPDATE
AS
BEGIN
SET NOCOUNT ON;

-- If inserting or updating these columns
IF UPDATE([ProductID]) OR UPDATE([OrderQty]) OR UPDATE([UnitPrice]) OR UPDATE([UnitPriceDiscount])
-- Insert record into TransactionHistory
BEGIN
INSERT INTO [Production].[TransactionHistory]
([ProductID]
,[ReferenceOrderID]
,[ReferenceOrderLineID]
,[TransactionType]
,[TransactionDate]
,[Quantity]
,[ActualCost])
SELECT
inserted.[ProductID]
,inserted.[SalesOrderID]
,inserted.[SalesOrderDetailID]
,'S'
,GETDATE()
,inserted.[OrderQty]
,inserted.[UnitPrice]
FROM inserted
INNER JOIN [Sales].[SalesOrderHeader]
ON inserted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID];

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

UPDATE [Sales].[Individual]
SET [Demographics].modify('declare default element namespace
"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
replace value of (/IndividualSurvey/TotalPurchaseYTD)[1]
with data(/IndividualSurvey/TotalPurchaseYTD)[1] + sql:column ("inserted.LineTotal")')
FROM inserted
INNER JOIN [Sales].[SalesOrderHeader]
ON inserted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID]
WHERE [Sales].[SalesOrderHeader].[CustomerID] = [Sales].[Individual].[CustomerID];

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;
END;

UPDATE [Sales].[SalesOrderDetail]
SET [Sales].[SalesOrderDetail].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesOrderID] = [Sales].[SalesOrderDetail].[SalesOrderID]
AND inserted.[SalesOrderDetailID] = [Sales].[SalesOrderDetail].[SalesOrderDetailID];

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

-- Update SubTotal in SalesOrderHeader record. Note that this causes the
-- SalesOrderHeader trigger to fire which will update the RevisionNumber.
UPDATE [Sales].[SalesOrderHeader]
SET [Sales].[SalesOrderHeader].[SubTotal] =
(SELECT SUM([Sales].[SalesOrderDetail].[LineTotal])
FROM [Sales].[SalesOrderDetail]
WHERE [Sales].[SalesOrderHeader].[SalesOrderID] = [Sales].[SalesOrderDetail].[SalesOrderID])
WHERE [Sales].[SalesOrderHeader].[SalesOrderID] IN (SELECT inserted.[SalesOrderID] FROM inserted);

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

UPDATE [Sales].[Individual]
SET [Demographics].modify('declare default element namespace
"http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
replace value of (/IndividualSurvey/TotalPurchaseYTD)[1]
with data(/IndividualSurvey/TotalPurchaseYTD)[1] - sql:column("deleted.LineTotal")')
FROM deleted
INNER JOIN [Sales].[SalesOrderHeader]
ON deleted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID]
WHERE [Sales].[SalesOrderHeader].[CustomerID] = [Sales].[Individual].[CustomerID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesOrderHeader - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesOrderHeader

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesOrderHeader] ON [Sales].[SalesOrderHeader]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

-- Update RevisionNumber for modification of any field EXCEPT the Status.
IF NOT UPDATE([Status])
BEGIN
UPDATE [Sales].[SalesOrderHeader]
SET [Sales].[SalesOrderHeader].[RevisionNumber] =
[Sales].[SalesOrderHeader].[RevisionNumber] + 1
WHERE [Sales].[SalesOrderHeader].[SalesOrderID] IN
(SELECT inserted.[SalesOrderID] FROM inserted);

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;
END;

-- Update the SalesPerson SalesYTD when SubTotal is updated
IF UPDATE([SubTotal])
BEGIN
DECLARE @StartDate datetime,
@EndDate datetime

SET @StartDate = [dbo].[ufnGetAccountingStartDate]();
SET @EndDate = [dbo].[ufnGetAccountingEndDate]();

UPDATE [Sales].[SalesPerson]
SET [Sales].[SalesPerson].[SalesYTD] =
(SELECT SUM([Sales].[SalesOrderHeader].[SubTotal])
FROM [Sales].[SalesOrderHeader]
WHERE [Sales].[SalesPerson].[SalesPersonID] = [Sales].[SalesOrderHeader].[SalesPersonID]
AND ([Sales].[SalesOrderHeader].[Status] = 5) -- Shipped
AND [Sales].[SalesOrderHeader].[OrderDate] BETWEEN @StartDate AND @EndDate)
WHERE [Sales].[SalesPerson].[SalesPersonID]
IN (SELECT DISTINCT inserted.[SalesPersonID] FROM inserted
WHERE inserted.[OrderDate] BETWEEN @StartDate AND @EndDate);

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;

-- Update the SalesTerritory SalesYTD when SubTotal is updated
UPDATE [Sales].[SalesTerritory]
SET [Sales].[SalesTerritory].[SalesYTD] =
(SELECT SUM([Sales].[SalesOrderHeader].[SubTotal])
FROM [Sales].[SalesOrderHeader]
WHERE [Sales].[SalesTerritory].[TerritoryID] = [Sales].[SalesOrderHeader].[TerritoryID]
AND ([Sales].[SalesOrderHeader].[Status] = 5) -- Shipped
AND [Sales].[SalesOrderHeader].[OrderDate] BETWEEN @StartDate AND @EndDate)
WHERE [Sales].[SalesTerritory].[TerritoryID]
IN (SELECT DISTINCT inserted.[TerritoryID] FROM inserted
WHERE inserted.[OrderDate] BETWEEN @StartDate AND @EndDate);

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END; -- End of IF (@@ERROR != 0)
END; -- End of IF UPDATE([SubTotal])

UPDATE [Sales].[SalesOrderHeader]
SET [Sales].[SalesOrderHeader].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesOrderHeaderSalesReason - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesOrderHeaderSalesReason

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesOrderHeaderSalesReason] ON [Sales].[SalesOrderHeaderSalesReason]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesOrderHeaderSalesReason]
SET [Sales].[SalesOrderHeaderSalesReason].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesOrderID] = [Sales].[SalesOrderHeaderSalesReason].[SalesOrderID]
AND inserted.[SalesReasonID] = [Sales].[SalesOrderHeaderSalesReason].[SalesReasonID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesPerson - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesPerson

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesPerson] ON [Sales].[SalesPerson]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesPerson]
SET [Sales].[SalesPerson].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesPersonID] = [Sales].[SalesPerson].[SalesPersonID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesPersonQuotaHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesPersonQuotaHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesPersonQuotaHistory] ON [Sales].[SalesPersonQuotaHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesPersonQuotaHistory]
SET [Sales].[SalesPersonQuotaHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesPersonID] = [Sales].[SalesPersonQuotaHistory].[SalesPersonID]
AND inserted.[QuotaDate] = [Sales].[SalesPersonQuotaHistory].[QuotaDate];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesReason - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesReason

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesReason] ON [Sales].[SalesReason]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesReason]
SET [Sales].[SalesReason].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesReasonID] = [Sales].[SalesReason].[SalesReasonID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesTaxRate - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesTaxRate

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesTaxRate] ON [Sales].[SalesTaxRate]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesTaxRate]
SET [Sales].[SalesTaxRate].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesTaxRateID] = [Sales].[SalesTaxRate].[SalesTaxRateID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesTerritory - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesTerritory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesTerritory] ON [Sales].[SalesTerritory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesTerritory]
SET [Sales].[SalesTerritory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[TerritoryID] = [Sales].[SalesTerritory].[TerritoryID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSalesTerritoryHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSalesTerritoryHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSalesTerritoryHistory] ON [Sales].[SalesTerritoryHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SalesTerritoryHistory]
SET [Sales].[SalesTerritoryHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SalesPersonID] = [Sales].[SalesTerritoryHistory].[SalesPersonID]
AND inserted.[StartDate] = [Sales].[SalesTerritoryHistory].[StartDate]
AND inserted.[TerritoryID] = [Sales].[SalesTerritoryHistory].[TerritoryID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uScrapReason - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uScrapReason

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uScrapReason] ON [Production].[ScrapReason]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[ScrapReason]
SET [Production].[ScrapReason].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ScrapReasonID] = [Production].[ScrapReason].[ScrapReasonID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


HumanResources.uShift - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.uShift

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [HumanResources].[uShift] ON [HumanResources].[Shift]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [HumanResources].[Shift]
SET [HumanResources].[Shift].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ShiftID] = [HumanResources].[Shift].[ShiftID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uShipMethod - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uShipMethod

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uShipMethod] ON [Purchasing].[ShipMethod]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Purchasing].[ShipMethod]
SET [Purchasing].[ShipMethod].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ShipMethodID] = [Purchasing].[ShipMethod].[ShipMethodID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uShoppingCartItem - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uShoppingCartItem

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uShoppingCartItem] ON [Sales].[ShoppingCartItem]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[ShoppingCartItem]
SET [Sales].[ShoppingCartItem].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[ShoppingCartItemID] = [Sales].[ShoppingCartItem].[ShoppingCartItemID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSpecialOffer - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSpecialOffer

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSpecialOffer] ON [Sales].[SpecialOffer]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SpecialOffer]
SET [Sales].[SpecialOffer].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SpecialOfferID] = [Sales].[SpecialOffer].[SpecialOfferID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uSpecialOfferProduct - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uSpecialOfferProduct

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uSpecialOfferProduct] ON [Sales].[SpecialOfferProduct]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[SpecialOfferProduct]
SET [Sales].[SpecialOfferProduct].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[SpecialOfferID] = [Sales].[SpecialOfferProduct].[SpecialOfferID]
AND inserted.[ProductID] = [Sales].[SpecialOfferProduct].[ProductID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Person.uStateProvince - Source code

Source code SQL 2005 Adventure Works OLTP

Person.uStateProvince

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Person].[uStateProvince] ON [Person].[StateProvince]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Person].[StateProvince]
SET [Person].[StateProvince].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[StateProvinceID] = [Person].[StateProvince].[StateProvinceID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.iStore - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.iStore

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[iStore] ON [Sales].[Store]
AFTER INSERT AS
BEGIN
SET NOCOUNT ON;

-- Only allow the Customer to be a Store OR Individual
IF EXISTS (SELECT * FROM inserted INNER JOIN [Sales].[Individual]
ON inserted.[CustomerID] = [Sales].[Individual].[CustomerID])
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uStore - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uStore

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uStore] ON [Sales].[Store]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[Store]
SET [Sales].[Store].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CustomerID] = [Sales].[Store].[CustomerID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Sales.uStoreContact - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.uStoreContact

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Sales].[uStoreContact] ON [Sales].[StoreContact]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Sales].[StoreContact]
SET [Sales].[StoreContact].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[CustomerID] = [Sales].[StoreContact].[CustomerID]
AND inserted.[ContactID] = [Sales].[StoreContact].[ContactID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uTransactionHistory - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uTransactionHistory

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uTransactionHistory] ON [Production].[TransactionHistory]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[TransactionHistory]
SET [Production].[TransactionHistory].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[TransactionID] = [Production].[TransactionHistory].[TransactionID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uTransactionHistoryArchive - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uTransactionHistoryArchive

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uTransactionHistoryArchive] ON [Production].[TransactionHistoryArchive]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[TransactionHistoryArchive]
SET [Production].[TransactionHistoryArchive].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[TransactionID] = [Production].[TransactionHistoryArchive].[TransactionID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uUnitMeasure - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uUnitMeasure

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uUnitMeasure] ON [Production].[UnitMeasure]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[UnitMeasure]
SET [Production].[UnitMeasure].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[UnitMeasureCode] = [Production].[UnitMeasure].[UnitMeasureCode];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.dVendor - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.dVendor

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[dVendor] ON [Purchasing].[Vendor]
INSTEAD OF DELETE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

DECLARE @DeleteCount int;

SELECT @DeleteCount = COUNT(*) FROM deleted;
IF @DeleteCount > 0
BEGIN
RAISERROR
(N'Vendors cannot be deleted. They can only be marked as not active.', -- Message
10, -- Severity.
1); -- State.

ROLLBACK TRANSACTION;
RETURN;
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uVendor - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uVendor

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uVendor] ON [Purchasing].[Vendor]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Purchasing].[Vendor]
SET [Purchasing].[Vendor].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[VendorID] = [Purchasing].[Vendor].[VendorID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uVendorAddress - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uVendorAddress

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uVendorAddress] ON [Purchasing].[VendorAddress]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Purchasing].[VendorAddress]
SET [Purchasing].[VendorAddress].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[VendorID] = [Purchasing].[VendorAddress].[VendorID]
AND inserted.[AddressID] = [Purchasing].[VendorAddress].[AddressID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Purchasing.uVendorContact - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.uVendorContact

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Purchasing].[uVendorContact] ON [Purchasing].[VendorContact]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Purchasing].[VendorContact]
SET [Purchasing].[VendorContact].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[VendorID] = [Purchasing].[VendorContact].[VendorID]
AND inserted.[ContactID] = [Purchasing].[VendorContact].[ContactID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.iWorkOrder - Source code

Source code SQL 2005 Adventure Works OLTP

Production.iWorkOrder

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[iWorkOrder] ON [Production].[WorkOrder]
AFTER INSERT AS
BEGIN
SET NOCOUNT ON;

INSERT INTO [Production].[TransactionHistory](
[ProductID]
,[ReferenceOrderID]
,[TransactionType]
,[TransactionDate]
,[Quantity]
,[ActualCost])
SELECT
inserted.[ProductID]
,inserted.[WorkOrderID]
,'W'
,GETDATE()
,inserted.[OrderQty]
,0
FROM inserted;

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uWorkOrder - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uWorkOrder

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uWorkOrder] ON [Production].[WorkOrder]
AFTER UPDATE AS
BEGIN
SET NOCOUNT ON;

IF UPDATE([ProductID]) OR UPDATE([OrderQty])
BEGIN
INSERT INTO [Production].[TransactionHistory](
[ProductID]
,[ReferenceOrderID]
,[TransactionType]
,[TransactionDate]
,[Quantity])
SELECT
inserted.[ProductID]
,inserted.[WorkOrderID]
,'W'
,GETDATE()
,inserted.[OrderQty]
FROM inserted;

IF (@@ERROR != 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END;
END;

UPDATE [Production].[WorkOrder]
SET [Production].[WorkOrder].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[WorkOrderID] = [Production].[WorkOrder].[WorkOrderID];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Production.uWorkOrderRouting - Source code

Source code SQL 2005 Adventure Works OLTP

Production.uWorkOrderRouting

Summary listing Bookmark Print Locate in contents

CREATE TRIGGER [Production].[uWorkOrderRouting] ON [Production].[WorkOrderRouting]
AFTER UPDATE NOT FOR REPLICATION AS
BEGIN
SET NOCOUNT ON;

UPDATE [Production].[WorkOrderRouting]
SET [Production].[WorkOrderRouting].[ModifiedDate] = GETDATE()
FROM inserted
WHERE inserted.[WorkOrderID] = [Production].[WorkOrderRouting].[WorkOrderID]
AND inserted.[ProductID] = [Production].[WorkOrderRouting].[ProductID]
AND inserted.[OperationSequence] = [Production].[WorkOrderRouting].[OperationSequence];
END;

-- Triggers
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Address table to the current date.', N'SCHEMA', [Person], N'TABLE', [Address], N'TRIGGER', [uAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AddressType table to the current date.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'TRIGGER', [uAddressType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the AWBuildVersion table to the current date.', N'SCHEMA', [dbo], N'TABLE', [AWBuildVersion], N'TRIGGER', [uAWBuildVersion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the BillOfMaterials table to the current date.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'TRIGGER', [uBillOfMaterials];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Contact table to the current date.', N'SCHEMA', [Person], N'TABLE', [Contact], N'TRIGGER', [uContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactCreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ContactCreditCard], N'TRIGGER', [uContactCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ContactType table to the current date.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'TRIGGER', [uContactType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegionCurrency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'TRIGGER', [uCountryRegionCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CountryRegion table to the current date.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'TRIGGER', [uCountryRegion];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CreditCard table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'TRIGGER', [uCreditCard];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Culture table to the current date.', N'SCHEMA', [Production], N'TABLE', [Culture], N'TRIGGER', [uCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Currency table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'TRIGGER', [uCurrency];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CurrencyRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'TRIGGER', [uCurrencyRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'TRIGGER', [uCustomer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the CustomerAddress table to the current date.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'TRIGGER', [uCustomerAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Department table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'TRIGGER', [uDepartment];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Document table to the current date.', N'SCHEMA', [Production], N'TABLE', [Document], N'TRIGGER', [uDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [dEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Employee table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'TRIGGER', [uEmployee];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeAddress table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'TRIGGER', [uEmployeeAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeeDepartmentHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'TRIGGER', [uEmployeeDepartmentHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the EmployeePayHistory table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeePayHistory], N'TRIGGER', [uEmployeePayHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Illustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'TRIGGER', [uIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'TRIGGER', [iuIndividual];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the JobCandidat table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'TRIGGER', [uJobCandidate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Location table to the current date.', N'SCHEMA', [Production], N'TABLE', [Location], N'TRIGGER', [uLocation];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Product table to the current date.', N'SCHEMA', [Production], N'TABLE', [Product], N'TRIGGER', [uProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'TRIGGER', [uProductCategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductCostHistory], N'TRIGGER', [uProductCostHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDescription table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'TRIGGER', [uProductDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductDocument table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductDocument], N'TRIGGER', [uProductDocument];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductInventory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'TRIGGER', [uProductInventory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductListPriceHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductListPriceHistory], N'TRIGGER', [uProductListPriceHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModel table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'TRIGGER', [uProductModel];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelIllustration table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelIllustration], N'TRIGGER', [uProductModelIllustration];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductModelProductDescriptionCulture table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductModelProductDescriptionCulture], N'TRIGGER', [uProductModelProductDescriptionCulture];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductPhoto], N'TRIGGER', [uProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductProductPhoto table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'TRIGGER', [uProductProductPhoto];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductReview table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'TRIGGER', [uProductReview];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductSubcategory table to the current date.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'TRIGGER', [uProductSubcategory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ProductVendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'TRIGGER', [uProductVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [iPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'TRIGGER', [uPurchaseOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'TRIGGER', [uPurchaseOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'TRIGGER', [iduSalesOrderDetail];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'TRIGGER', [uSalesOrderHeader];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesOrderHeaderSalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeaderSalesReason], N'TRIGGER', [uSalesOrderHeaderSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPerson table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'TRIGGER', [uSalesPerson];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesPersonQuotaHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'TRIGGER', [uSalesPersonQuotaHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesReason table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesReason], N'TRIGGER', [uSalesReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTaxRate table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'TRIGGER', [uSalesTaxRate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'TRIGGER', [uSalesTerritory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SalesTerritoryHistory table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'TRIGGER', [uSalesTerritoryHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ScrapReason table to the current date.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'TRIGGER', [uScrapReason];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Shift table to the current date.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'TRIGGER', [uShift];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShipMethod table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'TRIGGER', [uShipMethod];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the ShoppingCartItem table to the current date.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'TRIGGER', [uShoppingCartItem];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOffer table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'TRIGGER', [uSpecialOffer];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the SpecialOfferProduct table to the current date.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'TRIGGER', [uSpecialOfferProduct];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StateProvince table to the current date.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'TRIGGER', [uStateProvince];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [iStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Store table to the current date.', N'SCHEMA', [Sales], N'TABLE', [Store], N'TRIGGER', [uStore];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the StoreContact table to the current date.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'TRIGGER', [uStoreContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistory table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'TRIGGER', [uTransactionHistory];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the TransactionHistoryArchive table to the current date.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'TRIGGER', [uTransactionHistoryArchive];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the UnitMeasure table to the current date.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'TRIGGER', [uUnitMeasure];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'INSTEAD OF DELETE trigger which keeps Vendors from being deleted.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [dVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the Vendor table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'TRIGGER', [uVendor];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorAddress table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'TRIGGER', [uVendorAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the VendorContact table to the current date.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'TRIGGER', [uVendorContact];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER INSERT trigger that inserts a row in the TransactionHistory table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [iWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'TRIGGER', [uWorkOrder];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'AFTER UPDATE trigger setting the ModifiedDate column in the WorkOrderRouting table to the current date.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'TRIGGER', [uWorkOrderRouting];


Person.vAdditionalContactInfo - Source code

Source code SQL 2005 Adventure Works OLTP

Person.vAdditionalContactInfo

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Person].[vAdditionalContactInfo]
AS
SELECT
[ContactID]
,[FirstName]
,[MiddleName]
,[LastName]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:telephoneNumber)[1]/act:number', 'nvarchar(50)') AS [TelephoneNumber]
,LTRIM(RTRIM([ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:telephoneNumber/act:SpecialInstructions/text())[1]', 'nvarchar(max)'))) AS [TelephoneSpecialInstructions]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:homePostalAddress/act:Street)[1]', 'nvarchar(50)') AS [Street]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:homePostalAddress/act:City)[1]', 'nvarchar(50)') AS [City]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:homePostalAddress/act:StateProvince)[1]', 'nvarchar(50)') AS [StateProvince]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:homePostalAddress/act:PostalCode)[1]', 'nvarchar(50)') AS [PostalCode]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:homePostalAddress/act:CountryRegion)[1]', 'nvarchar(50)') AS [CountryRegion]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:homePostalAddress/act:SpecialInstructions/text())[1]', 'nvarchar(max)') AS [HomeAddressSpecialInstructions]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:eMail/act:eMailAddress)[1]', 'nvarchar(128)') AS [EMailAddress]
,LTRIM(RTRIM([ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:eMail/act:SpecialInstructions/text())[1]', 'nvarchar(max)'))) AS [EMailSpecialInstructions]
,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes";
(act:eMail/act:SpecialInstructions/act:telephoneNumber/act:number)[1]', 'nvarchar(50)') AS [EMailTelephoneNumber]
,[rowguid]
,[ModifiedDate]
FROM [Person].[Contact]
OUTER APPLY [AdditionalContactInfo].nodes(
'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo";
/ci:AdditionalContactInfo') AS ContactInfo(ref)
WHERE [AdditionalContactInfo] IS NOT NULL;

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


HumanResources.vEmployee - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.vEmployee

Summary listing Bookmark Print Locate in contents

CREATE VIEW [HumanResources].[vEmployee]
AS
SELECT
e.[EmployeeID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,e.[Title] AS [JobTitle]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,sp.[Name] AS [StateProvinceName]
,a.[PostalCode]
,cr.[Name] AS [CountryRegionName]
,c.[AdditionalContactInfo]
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = e.[ContactID]
INNER JOIN [HumanResources].[EmployeeAddress] ea
ON e.[EmployeeID] = ea.[EmployeeID]
INNER JOIN [Person].[Address] a
ON ea.[AddressID] = a.[AddressID]
INNER JOIN [Person].[StateProvince] sp
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr
ON cr.[CountryRegionCode] = sp.[CountryRegionCode];

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


HumanResources.vEmployeeDepartment - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.vEmployeeDepartment

Summary listing Bookmark Print Locate in contents

CREATE VIEW [HumanResources].[vEmployeeDepartment]
AS
SELECT
e.[EmployeeID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,e.[Title] AS [JobTitle]
,d.[Name] AS [Department]
,d.[GroupName]
,edh.[StartDate]
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = e.[ContactID]
INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh
ON e.[EmployeeID] = edh.[EmployeeID]
INNER JOIN [HumanResources].[Department] d
ON edh.[DepartmentID] = d.[DepartmentID]
WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


HumanResources.vEmployeeDepartmentHistory - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.vEmployeeDepartmentHistory

Summary listing Bookmark Print Locate in contents

CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory]
AS
SELECT
e.[EmployeeID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,s.[Name] AS [Shift]
,d.[Name] AS [Department]
,d.[GroupName]
,edh.[StartDate]
,edh.[EndDate]
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = e.[ContactID]
INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh
ON e.[EmployeeID] = edh.[EmployeeID]
INNER JOIN [HumanResources].[Department] d
ON edh.[DepartmentID] = d.[DepartmentID]
INNER JOIN [HumanResources].[Shift] s
ON s.[ShiftID] = edh.[ShiftID];

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Sales.vIndividual - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.vIndividual

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Sales].[vIndividual]
AS
SELECT
i.[CustomerID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,[StateProvinceName] = sp.[Name]
,a.[PostalCode]
,[CountryRegionName] = cr.[Name]
,i.[Demographics]
FROM [Sales].[Individual] i
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = i.[ContactID]
INNER JOIN [Sales].[CustomerAddress] ca
ON ca.[CustomerID] = i.[CustomerID]
INNER JOIN [Person].[Address] a
ON a.[AddressID] = ca.[AddressID]
INNER JOIN [Person].[StateProvince] sp
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr
ON cr.[CountryRegionCode] = sp.[CountryRegionCode]
WHERE i.[CustomerID] IN (SELECT [Sales].[Customer].[CustomerID]
FROM [Sales].[Customer] WHERE UPPER([Sales].[Customer].[CustomerType]) = 'I');

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Sales.vIndividualDemographics - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.vIndividualDemographics

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Sales].[vIndividualDemographics]
AS
SELECT
i.[CustomerID]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/TotalPurchaseYTD)[1]', 'money') AS [TotalPurchaseYTD]
,CONVERT(datetime, REPLACE([Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/DateFirstPurchase)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [DateFirstPurchase]
,CONVERT(datetime, REPLACE([Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/BirthDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [BirthDate]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/MaritalStatus)[1]', 'nvarchar(1)') AS [MaritalStatus]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/YearlyIncome)[1]', 'nvarchar(30)') AS [YearlyIncome]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/Gender)[1]', 'nvarchar(1)') AS [Gender]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/TotalChildren)[1]', 'integer') AS [TotalChildren]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/NumberChildrenAtHome)[1]', 'integer') AS [NumberChildrenAtHome]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/Education)[1]', 'nvarchar(30)') AS [Education]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/Occupation)[1]', 'nvarchar(30)') AS [Occupation]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/HomeOwnerFlag)[1]', 'bit') AS [HomeOwnerFlag]
,[Demographics].[value](N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(/IndividualSurvey/NumberCarsOwned)[1]', 'integer') AS [NumberCarsOwned]
,[Hobby].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
(.)', 'nvarchar(30)') AS [Hobby]
FROM [Sales].[Individual] i
CROSS APPLY i.[Demographics].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";
/IndividualSurvey/Hobby') AS [Hobby](ref)
WHERE [Demographics] IS NOT NULL;

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


HumanResources.vJobCandidate - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.vJobCandidate

Summary listing Bookmark Print Locate in contents

CREATE VIEW [HumanResources].[vJobCandidate]
AS
SELECT
jc.[JobCandidateID]
,jc.[EmployeeID]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/Name/Name.Prefix)[1]', 'nvarchar(30)') AS [Name.Prefix]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/Name/Name.First)[1]', 'nvarchar(30)') AS [Name.First]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/Name/Name.Middle)[1]', 'nvarchar(30)') AS [Name.Middle]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/Name/Name.Last)[1]', 'nvarchar(30)') AS [Name.Last]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/Name/Name.Suffix)[1]', 'nvarchar(30)') AS [Name.Suffix]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/Skills)[1]', 'nvarchar(max)') AS [Skills]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Address/Addr.Type)[1]', 'nvarchar(30)') AS [Addr.Type]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Address/Addr.Location/Location/Loc.CountryRegion)[1]', 'nvarchar(100)') AS [Addr.Loc.CountryRegion]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Address/Addr.Location/Location/Loc.State)[1]', 'nvarchar(100)') AS [Addr.Loc.State]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Address/Addr.Location/Location/Loc.City)[1]', 'nvarchar(100)') AS [Addr.Loc.City]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Address/Addr.PostalCode)[1]', 'nvarchar(20)') AS [Addr.PostalCode]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/EMail)[1]', 'nvarchar(max)') AS [EMail]
,[Resume].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/Resume/WebSite)[1]', 'nvarchar(max)') AS [WebSite]
,jc.[ModifiedDate]
FROM [HumanResources].[JobCandidate] jc
CROSS APPLY jc.[Resume].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
/Resume') AS Resume(ref);

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


HumanResources.vJobCandidateEmployment - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.vJobCandidateEmployment

Summary listing Bookmark Print Locate in contents

CREATE VIEW [HumanResources].[vJobCandidateEmployment]
AS
SELECT
jc.[JobCandidateID]
,CONVERT(datetime, REPLACE([Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.StartDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Emp.StartDate]
,CONVERT(datetime, REPLACE([Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.EndDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Emp.EndDate]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.OrgName)[1]', 'nvarchar(100)') AS [Emp.OrgName]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.JobTitle)[1]', 'nvarchar(100)') AS [Emp.JobTitle]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.Responsibility)[1]', 'nvarchar(max)') AS [Emp.Responsibility]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.FunctionCategory)[1]', 'nvarchar(max)') AS [Emp.FunctionCategory]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.IndustryCategory)[1]', 'nvarchar(max)') AS [Emp.IndustryCategory]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.Location/Location/Loc.CountryRegion)[1]', 'nvarchar(max)') AS [Emp.Loc.CountryRegion]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.Location/Location/Loc.State)[1]', 'nvarchar(max)') AS [Emp.Loc.State]
,[Employment].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Emp.Location/Location/Loc.City)[1]', 'nvarchar(max)') AS [Emp.Loc.City]
FROM [HumanResources].[JobCandidate] jc
CROSS APPLY jc.[Resume].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
/Resume/Employment') AS Employment(ref);

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


HumanResources.vJobCandidateEducation - Source code

Source code SQL 2005 Adventure Works OLTP

HumanResources.vJobCandidateEducation

Summary listing Bookmark Print Locate in contents

CREATE VIEW [HumanResources].[vJobCandidateEducation]
AS
SELECT
jc.[JobCandidateID]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Level)[1]', 'nvarchar(max)') AS [Edu.Level]
,CONVERT(datetime, REPLACE([Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.StartDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Edu.StartDate]
,CONVERT(datetime, REPLACE([Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.EndDate)[1]', 'nvarchar(20)') ,'Z', ''), 101) AS [Edu.EndDate]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Degree)[1]', 'nvarchar(50)') AS [Edu.Degree]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Major)[1]', 'nvarchar(50)') AS [Edu.Major]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Minor)[1]', 'nvarchar(50)') AS [Edu.Minor]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.GPA)[1]', 'nvarchar(5)') AS [Edu.GPA]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.GPAScale)[1]', 'nvarchar(5)') AS [Edu.GPAScale]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.School)[1]', 'nvarchar(100)') AS [Edu.School]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Location/Location/Loc.CountryRegion)[1]', 'nvarchar(100)') AS [Edu.Loc.CountryRegion]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Location/Location/Loc.State)[1]', 'nvarchar(100)') AS [Edu.Loc.State]
,[Education].ref.value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(Edu.Location/Location/Loc.City)[1]', 'nvarchar(100)') AS [Edu.Loc.City]
FROM [HumanResources].[JobCandidate] jc
CROSS APPLY jc.[Resume].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
/Resume/Education') AS [Education](ref);

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Production.vProductAndDescription - Source code

Source code SQL 2005 Adventure Works OLTP

Production.vProductAndDescription

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Production].[vProductAndDescription]
WITH SCHEMABINDING
AS
-- View (indexed or standard) to display products and product descriptions by language.
SELECT
p.[ProductID]
,p.[Name]
,pm.[Name] AS [ProductModel]
,pmx.[CultureID]
,pd.[Description]
FROM [Production].[Product] p
INNER JOIN [Production].[ProductModel] pm
ON p.[ProductModelID] = pm.[ProductModelID]
INNER JOIN [Production].[ProductModelProductDescriptionCulture] pmx
ON pm.[ProductModelID] = pmx.[ProductModelID]
INNER JOIN [Production].[ProductDescription] pd
ON pmx.[ProductDescriptionID] = pd.[ProductDescriptionID];

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vProductAndDescription.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], N'INDEX', [IX_vProductAndDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vStateProvinceCountryRegion.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], N'INDEX', [IX_vStateProvinceCountryRegion];


Production.vProductModelCatalogDescription - Source code

Source code SQL 2005 Adventure Works OLTP

Production.vProductModelCatalogDescription

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Production].[vProductModelCatalogDescription]
AS
SELECT
[ProductModelID]
,[Name]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace html="http://www.w3.org/1999/xhtml";
(/p1:ProductDescription/p1:Summary/html:p)[1]', 'nvarchar(max)') AS [Summary]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Manufacturer/p1:Name)[1]', 'nvarchar(max)') AS [Manufacturer]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Manufacturer/p1:Copyright)[1]', 'nvarchar(30)') AS [Copyright]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Manufacturer/p1:ProductURL)[1]', 'nvarchar(256)') AS [ProductURL]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain";
(/p1:ProductDescription/p1:Features/wm:Warranty/wm:WarrantyPeriod)[1]', 'nvarchar(256)') AS [WarrantyPeriod]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain";
(/p1:ProductDescription/p1:Features/wm:Warranty/wm:Description)[1]', 'nvarchar(256)') AS [WarrantyDescription]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain";
(/p1:ProductDescription/p1:Features/wm:Maintenance/wm:NoOfYears)[1]', 'nvarchar(256)') AS [NoOfYears]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wm="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelWarrAndMain";
(/p1:ProductDescription/p1:Features/wm:Maintenance/wm:Description)[1]', 'nvarchar(256)') AS [MaintenanceDescription]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures";
(/p1:ProductDescription/p1:Features/wf:wheel)[1]', 'nvarchar(256)') AS [Wheel]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures";
(/p1:ProductDescription/p1:Features/wf:saddle)[1]', 'nvarchar(256)') AS [Saddle]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures";
(/p1:ProductDescription/p1:Features/wf:pedal)[1]', 'nvarchar(256)') AS [Pedal]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures";
(/p1:ProductDescription/p1:Features/wf:BikeFrame)[1]', 'nvarchar(max)') AS [BikeFrame]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
declare namespace wf="http://www.adventure-works.com/schemas/OtherFeatures";
(/p1:ProductDescription/p1:Features/wf:crankset)[1]', 'nvarchar(256)') AS [Crankset]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Picture/p1:Angle)[1]', 'nvarchar(256)') AS [PictureAngle]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Picture/p1:Size)[1]', 'nvarchar(256)') AS [PictureSize]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Picture/p1:ProductPhotoID)[1]', 'nvarchar(256)') AS [ProductPhotoID]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Specifications/Material)[1]', 'nvarchar(256)') AS [Material]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Specifications/Color)[1]', 'nvarchar(256)') AS [Color]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Specifications/ProductLine)[1]', 'nvarchar(256)') AS [ProductLine]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Specifications/Style)[1]', 'nvarchar(256)') AS [Style]
,[CatalogDescription].value(N'declare namespace p1="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";
(/p1:ProductDescription/p1:Specifications/RiderExperience)[1]', 'nvarchar(1024)') AS [RiderExperience]
,[rowguid]
,[ModifiedDate]
FROM [Production].[ProductModel]
WHERE [CatalogDescription] IS NOT NULL;

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Production.vProductModelInstructions - Source code

Source code SQL 2005 Adventure Works OLTP

Production.vProductModelInstructions

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Production].[vProductModelInstructions]
AS
SELECT
[ProductModelID]
,[Name]
,[Instructions].value(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions";
(/root/text())[1]', 'nvarchar(max)') AS [Instructions]
,[MfgInstructions].ref.value('@LocationID[1]', 'int') AS [LocationID]
,[MfgInstructions].ref.value('@SetupHours[1]', 'decimal(9, 4)') AS [SetupHours]
,[MfgInstructions].ref.value('@MachineHours[1]', 'decimal(9, 4)') AS [MachineHours]
,[MfgInstructions].ref.value('@LaborHours[1]', 'decimal(9, 4)') AS [LaborHours]
,[MfgInstructions].ref.value('@LotSize[1]', 'int') AS [LotSize]
,[Steps].ref.value('string(.)[1]', 'nvarchar(1024)') AS [Step]
,[rowguid]
,[ModifiedDate]
FROM [Production].[ProductModel]
CROSS APPLY [Instructions].nodes(N'declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions";
/root/Location') MfgInstructions(ref)
CROSS APPLY [MfgInstructions].ref.nodes('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions";
step') Steps(ref);

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Sales.vSalesPerson - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.vSalesPerson

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Sales].[vSalesPerson]
AS
SELECT
s.[SalesPersonID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,[JobTitle] = e.[Title]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,[StateProvinceName] = sp.[Name]
,a.[PostalCode]
,[CountryRegionName] = cr.[Name]
,[TerritoryName] = st.[Name]
,[TerritoryGroup] = st.[Group]
,s.[SalesQuota]
,s.[SalesYTD]
,s.[SalesLastYear]
FROM [Sales].[SalesPerson] s
INNER JOIN [HumanResources].[Employee] e
ON e.[EmployeeID] = s.[SalesPersonID]
LEFT OUTER JOIN [Sales].[SalesTerritory] st
ON st.[TerritoryID] = s.[TerritoryID]
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = e.[ContactID]
INNER JOIN [HumanResources].[EmployeeAddress] ea
ON e.[EmployeeID] = ea.[EmployeeID]
INNER JOIN [Person].[Address] a
ON ea.[AddressID] = a.[AddressID]
INNER JOIN [Person].[StateProvince] sp
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr
ON cr.[CountryRegionCode] = sp.[CountryRegionCode];

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Sales.vSalesPersonSalesByFiscalYears - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.vSalesPersonSalesByFiscalYears

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Sales].[vSalesPersonSalesByFiscalYears]
AS
SELECT
pvt.[SalesPersonID]
,pvt.[FullName]
,pvt.[Title]
,pvt.[SalesTerritory]
,pvt.[2002]
,pvt.[2003]
,pvt.[2004]
FROM (SELECT
soh.[SalesPersonID]
,c.[FirstName] + ' ' + COALESCE(c.[MiddleName], '') + ' ' + c.[LastName] AS [FullName]
,e.[Title]
,st.[Name] AS [SalesTerritory]
,soh.[SubTotal]
,YEAR(DATEADD(m, 6, soh.[OrderDate])) AS [FiscalYear]
FROM [Sales].[SalesPerson] sp
INNER JOIN [Sales].[SalesOrderHeader] soh
ON sp.[SalesPersonID] = soh.[SalesPersonID]
INNER JOIN [Sales].[SalesTerritory] st
ON sp.[TerritoryID] = st.[TerritoryID]
INNER JOIN [HumanResources].[Employee] e
ON soh.[SalesPersonID] = e.[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.ContactID
) AS soh
PIVOT
(
SUM([SubTotal])
FOR [FiscalYear]
IN ([2002], [2003], [2004])
) AS pvt;

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Person.vStateProvinceCountryRegion - Source code

Source code SQL 2005 Adventure Works OLTP

Person.vStateProvinceCountryRegion

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Person].[vStateProvinceCountryRegion]
WITH SCHEMABINDING
AS
SELECT
sp.[StateProvinceID]
,sp.[StateProvinceCode]
,sp.[IsOnlyStateProvinceFlag]
,sp.[Name] AS [StateProvinceName]
,sp.[TerritoryID]
,cr.[CountryRegionCode]
,cr.[Name] AS [CountryRegionName]
FROM [Person].[StateProvince] sp
INNER JOIN [Person].[CountryRegion] cr
ON sp.[CountryRegionCode] = cr.[CountryRegionCode];

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vProductAndDescription.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], N'INDEX', [IX_vProductAndDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vStateProvinceCountryRegion.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], N'INDEX', [IX_vStateProvinceCountryRegion];


Sales.vStoreWithDemographics - Source code

Source code SQL 2005 Adventure Works OLTP

Sales.vStoreWithDemographics

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Sales].[vStoreWithDemographics] AS
SELECT
s.[CustomerID]
,s.[Name]
,ct.[Name] AS [ContactType]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,sp.[Name] AS [StateProvinceName]
,a.[PostalCode]
,cr.[Name] AS [CountryRegionName]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/AnnualSales)[1]', 'money') AS [AnnualSales]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/AnnualRevenue)[1]', 'money') AS [AnnualRevenue]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/BankName)[1]', 'nvarchar(50)') AS [BankName]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/BusinessType)[1]', 'nvarchar(5)') AS [BusinessType]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/YearOpened)[1]', 'integer') AS [YearOpened]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/Specialty)[1]', 'nvarchar(50)') AS [Specialty]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/SquareFeet)[1]', 'integer') AS [SquareFeet]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/Brands)[1]', 'nvarchar(30)') AS [Brands]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/Internet)[1]', 'nvarchar(30)') AS [Internet]
,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(/StoreSurvey/NumberEmployees)[1]', 'integer') AS [NumberEmployees]
FROM [Sales].[Store] s
INNER JOIN [Sales].[StoreContact] sc
ON sc.[CustomerID] = s.[CustomerID]
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = sc.[ContactID]
INNER JOIN [Person].[ContactType] ct
ON sc.[ContactTypeID] = ct.[ContactTypeID]
INNER JOIN [Sales].[CustomerAddress] ca
ON ca.[CustomerID] = s.[CustomerID]
INNER JOIN [Person].[Address] a
ON a.[AddressID] = ca.[AddressID]
INNER JOIN [Person].[StateProvince] sp
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr
ON cr.[CountryRegionCode] = sp.[CountryRegionCode]
WHERE s.[CustomerID] IN (SELECT [Sales].[Customer].[CustomerID]
FROM [Sales].[Customer] WHERE UPPER([Sales].[Customer].[CustomerType]) = 'S');

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


Purchasing.vVendor - Source code

Source code SQL 2005 Adventure Works OLTP

Purchasing.vVendor

Summary listing Bookmark Print Locate in contents

CREATE VIEW [Purchasing].[vVendor] AS
SELECT
v.[VendorID]
,v.[Name]
,ct.[Name] AS [ContactType]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,[StateProvinceName] = sp.[Name]
,a.[PostalCode]
,[CountryRegionName] = cr.[Name]
FROM [Purchasing].[Vendor] v
INNER JOIN [Purchasing].[VendorContact] vc
ON vc.[VendorID] = v.[VendorID]
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = vc.[ContactID]
INNER JOIN [Person].[ContactType] ct
ON vc.[ContactTypeID] = ct.[ContactTypeID]
INNER JOIN [Purchasing].[VendorAddress] va
ON va.[VendorID] = v.[VendorID]
INNER JOIN [Person].[Address] a
ON a.[AddressID] = va.[AddressID]
INNER JOIN [Person].[StateProvince] sp
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr
ON cr.[CountryRegionCode] = sp.[CountryRegionCode];

-- Views
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the contact name and content from each element in the xml column AdditionalContactInfo for that person.', N'SCHEMA', [Person], N'VIEW', [vAdditionalContactInfo], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Employee names and addresses.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployee], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name, title, and current department.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Returns employee name and current and previous departments.', N'SCHEMA', [HumanResources], N'VIEW', [vEmployeeDepartmentHistory], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Individual customers (names and addresses) that purchase Adventure Works Cycles products online.', N'SCHEMA', [Sales], N'VIEW', [vIndividual], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.', N'SCHEMA', [Sales], N'VIEW', [vIndividualDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Job candidate names and resumes.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidate], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEmployment], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'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.', N'SCHEMA', [HumanResources], N'VIEW', [vJobCandidateEducation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Product names and descriptions. Product descriptions are provided in multiple languages.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column CatalogDescription for each product in the Production.ProductModel table that has catalog data.', N'SCHEMA', [Production], N'VIEW', [vProductModelCatalogDescription], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Displays the content from each element in the xml column Instructions for each product in the Production.ProductModel table that has manufacturing instructions.', N'SCHEMA', [Production], N'VIEW', [vProductModelInstructions], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Sales representiatives (names and addresses) and their sales-related information.', N'SCHEMA', [Sales], N'VIEW', [vSalesPerson], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Uses PIVOT to return aggregated sales information for each sales representative.', N'SCHEMA', [Sales], N'VIEW', [vSalesPersonSalesByFiscalYears], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Joins StateProvince table with CountryRegion table.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Stores (names and addresses) that sell Adventure Works Cycles products to consumers.', N'SCHEMA', [Sales], N'VIEW', [vStoreWithDemographics], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Vendor (company) names and addresses and the names of vendor employees to contact.', N'SCHEMA', [Purchasing], N'VIEW', [vVendor], NULL, NULL;


AK_Address_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Address_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Address_rowguid] ON [Person].[Address]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode] ON [Person].[Address] ([AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode]) ON [PRIMARY];
CREATE INDEX [IX_Address_StateProvinceID] ON [Person].[Address]([StateProvinceID]) ON [PRIMARY];

-- Indexes
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [AK_Address_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [PK_Address_AddressID];


IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode - Source code

Source code SQL 2005 Adventure Works OLTP

IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Address_rowguid] ON [Person].[Address]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode] ON [Person].[Address] ([AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode]) ON [PRIMARY];
CREATE INDEX [IX_Address_StateProvinceID] ON [Person].[Address]([StateProvinceID]) ON [PRIMARY];

-- Indexes
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [AK_Address_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [PK_Address_AddressID];


IX_Address_StateProvinceID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_Address_StateProvinceID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Address_rowguid] ON [Person].[Address]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode] ON [Person].[Address] ([AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode]) ON [PRIMARY];
CREATE INDEX [IX_Address_StateProvinceID] ON [Person].[Address]([StateProvinceID]) ON [PRIMARY];

-- Indexes
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [AK_Address_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [IX_Address_StateProvinceID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Address], N'INDEX', [PK_Address_AddressID];


AK_AddressType_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_AddressType_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_AddressType_rowguid] ON [Person].[AddressType]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_AddressType_Name] ON [Person].[AddressType]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [AK_AddressType_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [AK_AddressType_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [PK_AddressType_AddressTypeID];


AK_AddressType_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_AddressType_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_AddressType_rowguid] ON [Person].[AddressType]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_AddressType_Name] ON [Person].[AddressType]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [AK_AddressType_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [AK_AddressType_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [AddressType], N'INDEX', [PK_AddressType_AddressTypeID];


IX_BillOfMaterials_UnitMeasureCode - Source code

Source code SQL 2005 Adventure Works OLTP

IX_BillOfMaterials_UnitMeasureCode

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_BillOfMaterials_UnitMeasureCode] ON [Production].[BillOfMaterials]([UnitMeasureCode]) ON [PRIMARY];
CREATE UNIQUE CLUSTERED INDEX [AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate] ON [Production].[BillOfMaterials]([ProductAssemblyID], [ComponentID], [StartDate]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [IX_BillOfMaterials_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [PK_BillOfMaterials_BillOfMaterialsID];


AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate - Source code

Source code SQL 2005 Adventure Works OLTP

AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_BillOfMaterials_UnitMeasureCode] ON [Production].[BillOfMaterials]([UnitMeasureCode]) ON [PRIMARY];
CREATE UNIQUE CLUSTERED INDEX [AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate] ON [Production].[BillOfMaterials]([ProductAssemblyID], [ComponentID], [StartDate]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [IX_BillOfMaterials_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [BillOfMaterials], N'INDEX', [PK_BillOfMaterials_BillOfMaterialsID];


AK_Contact_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Contact_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Contact_rowguid] ON [Person].[Contact]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Contact_EmailAddress] ON [Person].[Contact]([EmailAddress]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [IX_Contact_EmailAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [AK_Contact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PK_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PXML_Contact_AddContact];


IX_Contact_EmailAddress - Source code

Source code SQL 2005 Adventure Works OLTP

IX_Contact_EmailAddress

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Contact_rowguid] ON [Person].[Contact]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Contact_EmailAddress] ON [Person].[Contact]([EmailAddress]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [IX_Contact_EmailAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [AK_Contact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PK_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PXML_Contact_AddContact];


AK_ContactType_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ContactType_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ContactType_Name] ON [Person].[ContactType]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'INDEX', [AK_ContactType_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [ContactType], N'INDEX', [PK_ContactType_ContactTypeID];


IX_CountryRegionCurrency_CurrencyCode - Source code

Source code SQL 2005 Adventure Works OLTP

IX_CountryRegionCurrency_CurrencyCode

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_CountryRegionCurrency_CurrencyCode] ON [Sales].[CountryRegionCurrency]([CurrencyCode]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'INDEX', [IX_CountryRegionCurrency_CurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CountryRegionCurrency], N'INDEX', [PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode];


AK_CountryRegion_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_CountryRegion_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_CountryRegion_Name] ON [Person].[CountryRegion]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'INDEX', [AK_CountryRegion_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [CountryRegion], N'INDEX', [PK_CountryRegion_CountryRegionCode];


AK_CreditCard_CardNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AK_CreditCard_CardNumber

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_CreditCard_CardNumber] ON [Sales].[CreditCard]([CardNumber]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'INDEX', [AK_CreditCard_CardNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CreditCard], N'INDEX', [PK_CreditCard_CreditCardID];


AK_Culture_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Culture_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Culture_Name] ON [Production].[Culture]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Culture], N'INDEX', [AK_Culture_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Culture], N'INDEX', [PK_Culture_CultureID];


AK_Currency_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Currency_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Currency_Name] ON [Sales].[Currency]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'INDEX', [AK_Currency_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Currency], N'INDEX', [PK_Currency_CurrencyCode];


AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode - Source code

Source code SQL 2005 Adventure Works OLTP

AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode] ON [Sales].[CurrencyRate]([CurrencyRateDate], [FromCurrencyCode], [ToCurrencyCode]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'INDEX', [AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CurrencyRate], N'INDEX', [PK_CurrencyRate_CurrencyRateID];


AK_Customer_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Customer_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Customer_rowguid] ON [Sales].[Customer]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Customer_AccountNumber] ON [Sales].[Customer]([AccountNumber]) ON [PRIMARY];
CREATE INDEX [IX_Customer_TerritoryID] ON [Sales].[Customer]([TerritoryID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [IX_Customer_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [PK_Customer_CustomerID];


AK_Customer_AccountNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Customer_AccountNumber

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Customer_rowguid] ON [Sales].[Customer]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Customer_AccountNumber] ON [Sales].[Customer]([AccountNumber]) ON [PRIMARY];
CREATE INDEX [IX_Customer_TerritoryID] ON [Sales].[Customer]([TerritoryID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [IX_Customer_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [PK_Customer_CustomerID];


IX_Customer_TerritoryID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_Customer_TerritoryID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Customer_rowguid] ON [Sales].[Customer]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Customer_AccountNumber] ON [Sales].[Customer]([AccountNumber]) ON [PRIMARY];
CREATE INDEX [IX_Customer_TerritoryID] ON [Sales].[Customer]([TerritoryID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [AK_Customer_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [IX_Customer_TerritoryID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Customer], N'INDEX', [PK_Customer_CustomerID];


AK_CustomerAddress_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_CustomerAddress_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_CustomerAddress_rowguid] ON [Sales].[CustomerAddress]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'INDEX', [AK_CustomerAddress_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [CustomerAddress], N'INDEX', [PK_CustomerAddress_CustomerID_AddressID];


AK_Department_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Department_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Department_Name] ON [HumanResources].[Department]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'INDEX', [AK_Department_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Department], N'INDEX', [PK_Department_DepartmentID];


AK_Document_FileName_Revision - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Document_FileName_Revision

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Document_FileName_Revision] ON [Production].[Document]([FileName], [Revision]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Document], N'INDEX', [AK_Document_FileName_Revision];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Document], N'INDEX', [PK_Document_DocumentID];


AK_Employee_LoginID - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Employee_LoginID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Employee_LoginID] ON [HumanResources].[Employee]([LoginID]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_NationalIDNumber] ON [HumanResources].[Employee]([NationalIDNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_rowguid] ON [HumanResources].[Employee]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Employee_ManagerID] ON [HumanResources].[Employee]([ManagerID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_LoginID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_NationalIDNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [IX_Employee_ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [PK_Employee_EmployeeID];


AK_Employee_NationalIDNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Employee_NationalIDNumber

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Employee_LoginID] ON [HumanResources].[Employee]([LoginID]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_NationalIDNumber] ON [HumanResources].[Employee]([NationalIDNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_rowguid] ON [HumanResources].[Employee]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Employee_ManagerID] ON [HumanResources].[Employee]([ManagerID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_LoginID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_NationalIDNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [IX_Employee_ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [PK_Employee_EmployeeID];


AK_Employee_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Employee_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Employee_LoginID] ON [HumanResources].[Employee]([LoginID]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_NationalIDNumber] ON [HumanResources].[Employee]([NationalIDNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_rowguid] ON [HumanResources].[Employee]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Employee_ManagerID] ON [HumanResources].[Employee]([ManagerID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_LoginID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_NationalIDNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [IX_Employee_ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [PK_Employee_EmployeeID];


IX_Employee_ManagerID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_Employee_ManagerID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Employee_LoginID] ON [HumanResources].[Employee]([LoginID]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_NationalIDNumber] ON [HumanResources].[Employee]([NationalIDNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Employee_rowguid] ON [HumanResources].[Employee]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Employee_ManagerID] ON [HumanResources].[Employee]([ManagerID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_LoginID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_NationalIDNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [AK_Employee_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [IX_Employee_ManagerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Employee], N'INDEX', [PK_Employee_EmployeeID];


AK_EmployeeAddress_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_EmployeeAddress_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_EmployeeAddress_rowguid] ON [HumanResources].[EmployeeAddress]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'INDEX', [AK_EmployeeAddress_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeAddress], N'INDEX', [PK_EmployeeAddress_EmployeeID_AddressID];


IX_EmployeeDepartmentHistory_DepartmentID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_EmployeeDepartmentHistory_DepartmentID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_EmployeeDepartmentHistory_DepartmentID] ON [HumanResources].[EmployeeDepartmentHistory]([DepartmentID]) ON [PRIMARY];
CREATE INDEX [IX_EmployeeDepartmentHistory_ShiftID] ON [HumanResources].[EmployeeDepartmentHistory]([ShiftID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [IX_EmployeeDepartmentHistory_DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [IX_EmployeeDepartmentHistory_ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID];


IX_EmployeeDepartmentHistory_ShiftID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_EmployeeDepartmentHistory_ShiftID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_EmployeeDepartmentHistory_DepartmentID] ON [HumanResources].[EmployeeDepartmentHistory]([DepartmentID]) ON [PRIMARY];
CREATE INDEX [IX_EmployeeDepartmentHistory_ShiftID] ON [HumanResources].[EmployeeDepartmentHistory]([ShiftID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [IX_EmployeeDepartmentHistory_DepartmentID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [IX_EmployeeDepartmentHistory_ShiftID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [EmployeeDepartmentHistory], N'INDEX', [PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID];


IX_JobCandidate_EmployeeID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_JobCandidate_EmployeeID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_JobCandidate_EmployeeID] ON [HumanResources].[JobCandidate]([EmployeeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'INDEX', [IX_JobCandidate_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [JobCandidate], N'INDEX', [PK_JobCandidate_JobCandidateID];


AK_Location_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Location_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Location_Name] ON [Production].[Location]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [AK_Location_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [PK_Product_ProductID];


AK_Product_ProductNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Product_ProductNumber

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Product_ProductNumber] ON [Production].[Product]([ProductNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Product_Name] ON [Production].[Product]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Product_rowguid] ON [Production].[Product]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [AK_Location_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [PK_Product_ProductID];


AK_Product_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Product_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Product_ProductNumber] ON [Production].[Product]([ProductNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Product_Name] ON [Production].[Product]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Product_rowguid] ON [Production].[Product]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [AK_Location_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [PK_Product_ProductID];


AK_Product_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Product_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Product_ProductNumber] ON [Production].[Product]([ProductNumber]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Product_Name] ON [Production].[Product]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Product_rowguid] ON [Production].[Product]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [AK_Location_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Location], N'INDEX', [PK_Location_LocationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_ProductNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [AK_Product_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Product], N'INDEX', [PK_Product_ProductID];


AK_ProductCategory_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductCategory_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductCategory_Name] ON [Production].[ProductCategory]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ProductCategory_rowguid] ON [Production].[ProductCategory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [AK_ProductCategory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [AK_ProductCategory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [PK_ProductCategory_ProductCategoryID];


AK_ProductCategory_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductCategory_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductCategory_Name] ON [Production].[ProductCategory]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ProductCategory_rowguid] ON [Production].[ProductCategory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [AK_ProductCategory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [AK_ProductCategory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductCategory], N'INDEX', [PK_ProductCategory_ProductCategoryID];


AK_ProductDescription_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductDescription_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductDescription_rowguid] ON [Production].[ProductDescription]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'INDEX', [AK_ProductDescription_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductDescription], N'INDEX', [PK_ProductDescription_ProductDescriptionID];


AK_ProductInventory_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductInventory_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductInventory_rowguid] ON [Production].[ProductInventory]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_ProductInventory_ProductID] ON [Production].[ProductInventory]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [AK_ProductInventory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [IX_ProductInventory_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [PK_ProductInventory_ProductID_LocationID];


IX_ProductInventory_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_ProductInventory_ProductID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductInventory_rowguid] ON [Production].[ProductInventory]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_ProductInventory_ProductID] ON [Production].[ProductInventory]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [AK_ProductInventory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [IX_ProductInventory_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductInventory], N'INDEX', [PK_ProductInventory_ProductID_LocationID];


AK_ProductModel_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductModel_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductModel_Name] ON [Production].[ProductModel]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ProductModel_rowguid] ON [Production].[ProductModel]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PK_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_CatalogDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_Instructions];


AK_ProductModel_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductModel_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductModel_Name] ON [Production].[ProductModel]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ProductModel_rowguid] ON [Production].[ProductModel]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PK_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_CatalogDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_Instructions];


AK_ProductProductPhoto_ProductID_ProductPhotoID - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductProductPhoto_ProductID_ProductPhotoID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE NONCLUSTERED INDEX [AK_ProductProductPhoto_ProductID_ProductPhotoID] ON [Production].[ProductProductPhoto]([ProductID], [ProductPhotoID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductProductPhoto], N'INDEX', [AK_ProductProductPhoto_ProductID_ProductPhotoID];


IX_ProductReview_ProductID_Name - Source code

Source code SQL 2005 Adventure Works OLTP

IX_ProductReview_ProductID_Name

Summary listing Bookmark Print Locate in contents

CREATE NONCLUSTERED INDEX [IX_ProductReview_ProductID_Name] ON [Production].[ProductReview]([ProductID], [ReviewerName]) INCLUDE ([Comments]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'INDEX', [IX_ProductReview_ProductID_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductReview], N'INDEX', [PK_ProductReview_ProductReviewID];


AK_ProductSubcategory_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductSubcategory_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductSubcategory_Name] ON [Production].[ProductSubcategory]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ProductSubcategory_rowguid] ON [Production].[ProductSubcategory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [AK_ProductSubcategory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [AK_ProductSubcategory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [PK_ProductSubcategory_ProductSubcategoryID];


AK_ProductSubcategory_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ProductSubcategory_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ProductSubcategory_Name] ON [Production].[ProductSubcategory]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ProductSubcategory_rowguid] ON [Production].[ProductSubcategory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [AK_ProductSubcategory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [AK_ProductSubcategory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductSubcategory], N'INDEX', [PK_ProductSubcategory_ProductSubcategoryID];


IX_ProductVendor_UnitMeasureCode - Source code

Source code SQL 2005 Adventure Works OLTP

IX_ProductVendor_UnitMeasureCode

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_ProductVendor_UnitMeasureCode] ON [Purchasing].[ProductVendor]([UnitMeasureCode]) ON [PRIMARY];
CREATE INDEX [IX_ProductVendor_VendorID] ON [Purchasing].[ProductVendor]([VendorID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [IX_ProductVendor_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [IX_ProductVendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [PK_ProductVendor_ProductID_VendorID];


IX_ProductVendor_VendorID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_ProductVendor_VendorID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_ProductVendor_UnitMeasureCode] ON [Purchasing].[ProductVendor]([UnitMeasureCode]) ON [PRIMARY];
CREATE INDEX [IX_ProductVendor_VendorID] ON [Purchasing].[ProductVendor]([VendorID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [IX_ProductVendor_UnitMeasureCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [IX_ProductVendor_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [ProductVendor], N'INDEX', [PK_ProductVendor_ProductID_VendorID];


IX_PurchaseOrderDetail_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_PurchaseOrderDetail_ProductID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_PurchaseOrderDetail_ProductID] ON [Purchasing].[PurchaseOrderDetail]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'INDEX', [IX_PurchaseOrderDetail_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderDetail], N'INDEX', [PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID];


IX_PurchaseOrderHeader_VendorID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_PurchaseOrderHeader_VendorID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_PurchaseOrderHeader_VendorID] ON [Purchasing].[PurchaseOrderHeader]([VendorID]) ON [PRIMARY];
CREATE INDEX [IX_PurchaseOrderHeader_EmployeeID] ON [Purchasing].[PurchaseOrderHeader]([EmployeeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [IX_PurchaseOrderHeader_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [IX_PurchaseOrderHeader_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [PK_PurchaseOrderHeader_PurchaseOrderID];


IX_PurchaseOrderHeader_EmployeeID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_PurchaseOrderHeader_EmployeeID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_PurchaseOrderHeader_VendorID] ON [Purchasing].[PurchaseOrderHeader]([VendorID]) ON [PRIMARY];
CREATE INDEX [IX_PurchaseOrderHeader_EmployeeID] ON [Purchasing].[PurchaseOrderHeader]([EmployeeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [IX_PurchaseOrderHeader_EmployeeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [IX_PurchaseOrderHeader_VendorID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [PurchaseOrderHeader], N'INDEX', [PK_PurchaseOrderHeader_PurchaseOrderID];


AK_SalesOrderDetail_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesOrderDetail_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesOrderDetail_rowguid] ON [Sales].[SalesOrderDetail]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderDetail_ProductID] ON [Sales].[SalesOrderDetail]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [AK_SalesOrderDetail_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [IX_SalesOrderDetail_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID];


IX_SalesOrderDetail_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_SalesOrderDetail_ProductID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesOrderDetail_rowguid] ON [Sales].[SalesOrderDetail]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderDetail_ProductID] ON [Sales].[SalesOrderDetail]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [AK_SalesOrderDetail_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [IX_SalesOrderDetail_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderDetail], N'INDEX', [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID];


AK_SalesOrderHeader_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesOrderHeader_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesOrderHeader_rowguid] ON [Sales].[SalesOrderHeader]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesOrderHeader_SalesOrderNumber] ON [Sales].[SalesOrderHeader]([SalesOrderNumber]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_CustomerID] ON [Sales].[SalesOrderHeader]([CustomerID]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_SalesPersonID] ON [Sales].[SalesOrderHeader]([SalesPersonID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_SalesOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [PK_SalesOrderHeader_SalesOrderID];


AK_SalesOrderHeader_SalesOrderNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesOrderHeader_SalesOrderNumber

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesOrderHeader_rowguid] ON [Sales].[SalesOrderHeader]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesOrderHeader_SalesOrderNumber] ON [Sales].[SalesOrderHeader]([SalesOrderNumber]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_CustomerID] ON [Sales].[SalesOrderHeader]([CustomerID]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_SalesPersonID] ON [Sales].[SalesOrderHeader]([SalesPersonID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_SalesOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [PK_SalesOrderHeader_SalesOrderID];


IX_SalesOrderHeader_CustomerID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_SalesOrderHeader_CustomerID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesOrderHeader_rowguid] ON [Sales].[SalesOrderHeader]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesOrderHeader_SalesOrderNumber] ON [Sales].[SalesOrderHeader]([SalesOrderNumber]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_CustomerID] ON [Sales].[SalesOrderHeader]([CustomerID]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_SalesPersonID] ON [Sales].[SalesOrderHeader]([SalesPersonID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_SalesOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [PK_SalesOrderHeader_SalesOrderID];


IX_SalesOrderHeader_SalesPersonID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_SalesOrderHeader_SalesPersonID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesOrderHeader_rowguid] ON [Sales].[SalesOrderHeader]([rowguid]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesOrderHeader_SalesOrderNumber] ON [Sales].[SalesOrderHeader]([SalesOrderNumber]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_CustomerID] ON [Sales].[SalesOrderHeader]([CustomerID]) ON [PRIMARY];
CREATE INDEX [IX_SalesOrderHeader_SalesPersonID] ON [Sales].[SalesOrderHeader]([SalesPersonID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [AK_SalesOrderHeader_SalesOrderNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [IX_SalesOrderHeader_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesOrderHeader], N'INDEX', [PK_SalesOrderHeader_SalesOrderID];


AK_SalesPerson_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesPerson_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesPerson_rowguid] ON [Sales].[SalesPerson]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'INDEX', [AK_SalesPerson_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesPerson], N'INDEX', [PK_SalesPerson_SalesPersonID];


AK_SalesPersonQuotaHistory_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesPersonQuotaHistory_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesPersonQuotaHistory_rowguid] ON [Sales].[SalesPersonQuotaHistory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'INDEX', [AK_SalesPersonQuotaHistory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesPersonQuotaHistory], N'INDEX', [PK_SalesPersonQuotaHistory_SalesPersonID_QuotaDate];


AK_SalesTaxRate_StateProvinceID_TaxType - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesTaxRate_StateProvinceID_TaxType

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesTaxRate_StateProvinceID_TaxType] ON [Sales].[SalesTaxRate]([StateProvinceID], [TaxType]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesTaxRate_rowguid] ON [Sales].[SalesTaxRate]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [AK_SalesTaxRate_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [AK_SalesTaxRate_StateProvinceID_TaxType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [PK_SalesTaxRate_SalesTaxRateID];


AK_SalesTaxRate_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesTaxRate_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesTaxRate_StateProvinceID_TaxType] ON [Sales].[SalesTaxRate]([StateProvinceID], [TaxType]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesTaxRate_rowguid] ON [Sales].[SalesTaxRate]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [AK_SalesTaxRate_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [AK_SalesTaxRate_StateProvinceID_TaxType];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTaxRate], N'INDEX', [PK_SalesTaxRate_SalesTaxRateID];


AK_SalesTerritory_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesTerritory_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesTerritory_Name] ON [Sales].[SalesTerritory]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesTerritory_rowguid] ON [Sales].[SalesTerritory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [AK_SalesTerritory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [AK_SalesTerritory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [PK_SalesTerritory_TerritoryID];


AK_SalesTerritory_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesTerritory_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesTerritory_Name] ON [Sales].[SalesTerritory]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_SalesTerritory_rowguid] ON [Sales].[SalesTerritory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [AK_SalesTerritory_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [AK_SalesTerritory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritory], N'INDEX', [PK_SalesTerritory_TerritoryID];


AK_SalesTerritoryHistory_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SalesTerritoryHistory_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SalesTerritoryHistory_rowguid] ON [Sales].[SalesTerritoryHistory]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'INDEX', [AK_SalesTerritoryHistory_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SalesTerritoryHistory], N'INDEX', [PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID];


AK_ScrapReason_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ScrapReason_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ScrapReason_Name] ON [Production].[ScrapReason]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'INDEX', [AK_ScrapReason_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ScrapReason], N'INDEX', [PK_ScrapReason_ScrapReasonID];


AK_Shift_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Shift_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Shift_Name] ON [HumanResources].[Shift]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Shift_StartTime_EndTime] ON [HumanResources].[Shift]([StartTime], [EndTime]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [AK_Shift_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [AK_Shift_StartTime_EndTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [PK_Shift_ShiftID];


AK_Shift_StartTime_EndTime - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Shift_StartTime_EndTime

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Shift_Name] ON [HumanResources].[Shift]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_Shift_StartTime_EndTime] ON [HumanResources].[Shift]([StartTime], [EndTime]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [AK_Shift_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [AK_Shift_StartTime_EndTime];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [HumanResources], N'TABLE', [Shift], N'INDEX', [PK_Shift_ShiftID];


AK_ShipMethod_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ShipMethod_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ShipMethod_Name] ON [Purchasing].[ShipMethod]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ShipMethod_rowguid] ON [Purchasing].[ShipMethod]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [AK_ShipMethod_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [AK_ShipMethod_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [PK_ShipMethod_ShipMethodID];


AK_ShipMethod_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_ShipMethod_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_ShipMethod_Name] ON [Purchasing].[ShipMethod]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_ShipMethod_rowguid] ON [Purchasing].[ShipMethod]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [AK_ShipMethod_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [AK_ShipMethod_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [ShipMethod], N'INDEX', [PK_ShipMethod_ShipMethodID];


IX_ShoppingCartItem_ShoppingCartID_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_ShoppingCartItem_ShoppingCartID_ProductID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_ShoppingCartItem_ShoppingCartID_ProductID] ON [Sales].[ShoppingCartItem]([ShoppingCartID], [ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'INDEX', [IX_ShoppingCartItem_ShoppingCartID_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [ShoppingCartItem], N'INDEX', [PK_ShoppingCartItem_ShoppingCartItemID];


AK_SpecialOffer_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SpecialOffer_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SpecialOffer_rowguid] ON [Sales].[SpecialOffer]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'INDEX', [AK_SpecialOffer_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SpecialOffer], N'INDEX', [PK_SpecialOffer_SpecialOfferID];


AK_SpecialOfferProduct_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_SpecialOfferProduct_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SpecialOfferProduct_rowguid] ON [Sales].[SpecialOfferProduct]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_SpecialOfferProduct_ProductID] ON [Sales].[SpecialOfferProduct]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [AK_SpecialOfferProduct_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [IX_SpecialOfferProduct_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [PK_SpecialOfferProduct_SpecialOfferID_ProductID];


IX_SpecialOfferProduct_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_SpecialOfferProduct_ProductID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_SpecialOfferProduct_rowguid] ON [Sales].[SpecialOfferProduct]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_SpecialOfferProduct_ProductID] ON [Sales].[SpecialOfferProduct]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [AK_SpecialOfferProduct_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [IX_SpecialOfferProduct_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [SpecialOfferProduct], N'INDEX', [PK_SpecialOfferProduct_SpecialOfferID_ProductID];


AK_StateProvince_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_StateProvince_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_StateProvince_Name] ON [Person].[StateProvince]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_StateProvince_StateProvinceCode_CountryRegionCode] ON [Person].[StateProvince]([StateProvinceCode], [CountryRegionCode]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_StateProvince_rowguid] ON [Person].[StateProvince]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_StateProvinceCode_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [PK_StateProvince_StateProvinceID];


AK_StateProvince_StateProvinceCode_CountryRegionCode - Source code

Source code SQL 2005 Adventure Works OLTP

AK_StateProvince_StateProvinceCode_CountryRegionCode

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_StateProvince_Name] ON [Person].[StateProvince]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_StateProvince_StateProvinceCode_CountryRegionCode] ON [Person].[StateProvince]([StateProvinceCode], [CountryRegionCode]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_StateProvince_rowguid] ON [Person].[StateProvince]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_StateProvinceCode_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [PK_StateProvince_StateProvinceID];


AK_StateProvince_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_StateProvince_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_StateProvince_Name] ON [Person].[StateProvince]([Name]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_StateProvince_StateProvinceCode_CountryRegionCode] ON [Person].[StateProvince]([StateProvinceCode], [CountryRegionCode]) ON [PRIMARY];
CREATE UNIQUE INDEX [AK_StateProvince_rowguid] ON [Person].[StateProvince]([rowguid]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [AK_StateProvince_StateProvinceCode_CountryRegionCode];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [StateProvince], N'INDEX', [PK_StateProvince_StateProvinceID];


AK_Store_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Store_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Store_rowguid] ON [Sales].[Store]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Store_SalesPersonID] ON [Sales].[Store]([SalesPersonID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [AK_Store_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PK_Store_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [IX_Store_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PXML_Store_Demographics];


IX_Store_SalesPersonID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_Store_SalesPersonID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Store_rowguid] ON [Sales].[Store]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_Store_SalesPersonID] ON [Sales].[Store]([SalesPersonID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [AK_Store_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PK_Store_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [IX_Store_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PXML_Store_Demographics];


AK_StoreContact_rowguid - Source code

Source code SQL 2005 Adventure Works OLTP

AK_StoreContact_rowguid

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_StoreContact_rowguid] ON [Sales].[StoreContact]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_StoreContact_ContactID] ON [Sales].[StoreContact]([ContactID]) ON [PRIMARY];
CREATE INDEX [IX_StoreContact_ContactTypeID] ON [Sales].[StoreContact]([ContactTypeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [AK_StoreContact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [PK_StoreContact_CustomerID_ContactID];


IX_StoreContact_ContactID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_StoreContact_ContactID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_StoreContact_rowguid] ON [Sales].[StoreContact]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_StoreContact_ContactID] ON [Sales].[StoreContact]([ContactID]) ON [PRIMARY];
CREATE INDEX [IX_StoreContact_ContactTypeID] ON [Sales].[StoreContact]([ContactTypeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [AK_StoreContact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [PK_StoreContact_CustomerID_ContactID];


IX_StoreContact_ContactTypeID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_StoreContact_ContactTypeID

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_StoreContact_rowguid] ON [Sales].[StoreContact]([rowguid]) ON [PRIMARY];
CREATE INDEX [IX_StoreContact_ContactID] ON [Sales].[StoreContact]([ContactID]) ON [PRIMARY];
CREATE INDEX [IX_StoreContact_ContactTypeID] ON [Sales].[StoreContact]([ContactTypeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [AK_StoreContact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [IX_StoreContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [StoreContact], N'INDEX', [PK_StoreContact_CustomerID_ContactID];


IX_TransactionHistory_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_TransactionHistory_ProductID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_TransactionHistory_ProductID] ON [Production].[TransactionHistory]([ProductID]) ON [PRIMARY];
CREATE INDEX [IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID] ON [Production].[TransactionHistory]([ReferenceOrderID], [ReferenceOrderLineID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [IX_TransactionHistory_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [PK_TransactionHistory_TransactionID];


IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_TransactionHistory_ProductID] ON [Production].[TransactionHistory]([ProductID]) ON [PRIMARY];
CREATE INDEX [IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID] ON [Production].[TransactionHistory]([ReferenceOrderID], [ReferenceOrderLineID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [IX_TransactionHistory_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.>', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [TransactionHistory], N'INDEX', [PK_TransactionHistory_TransactionID];


IX_TransactionHistoryArchive_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_TransactionHistoryArchive_ProductID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_TransactionHistoryArchive_ProductID] ON [Production].[TransactionHistoryArchive]([ProductID]) ON [PRIMARY];
CREATE INDEX [IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID] ON [Production].[TransactionHistoryArchive]([ReferenceOrderID], [ReferenceOrderLineID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [IX_TransactionHistoryArchive_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [PK_TransactionHistoryArchive_TransactionID];


IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_TransactionHistoryArchive_ProductID] ON [Production].[TransactionHistoryArchive]([ProductID]) ON [PRIMARY];
CREATE INDEX [IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID] ON [Production].[TransactionHistoryArchive]([ReferenceOrderID], [ReferenceOrderLineID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [IX_TransactionHistoryArchive_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [TransactionHistoryArchive], N'INDEX', [PK_TransactionHistoryArchive_TransactionID];


AK_UnitMeasure_Name - Source code

Source code SQL 2005 Adventure Works OLTP

AK_UnitMeasure_Name

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_UnitMeasure_Name] ON [Production].[UnitMeasure]([Name]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'INDEX', [AK_UnitMeasure_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [UnitMeasure], N'INDEX', [PK_UnitMeasure_UnitMeasureCode];


AK_Vendor_AccountNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AK_Vendor_AccountNumber

Summary listing Bookmark Print Locate in contents

CREATE UNIQUE INDEX [AK_Vendor_AccountNumber] ON [Purchasing].[Vendor]([AccountNumber]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'INDEX', [AK_Vendor_AccountNumber];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [Vendor], N'INDEX', [PK_Vendor_VendorID];


IX_VendorAddress_AddressID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_VendorAddress_AddressID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_VendorAddress_AddressID] ON [Purchasing].[VendorAddress]([AddressID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'INDEX', [IX_VendorAddress_AddressID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [VendorAddress], N'INDEX', [PK_VendorAddress_VendorID_AddressID];


IX_VendorContact_ContactID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_VendorContact_ContactID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_VendorContact_ContactID] ON [Purchasing].[VendorContact]([ContactID]) ON [PRIMARY];
CREATE INDEX [IX_VendorContact_ContactTypeID] ON [Purchasing].[VendorContact]([ContactTypeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [IX_VendorContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [IX_VendorContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [PK_VendorContact_VendorID_ContactID];


IX_VendorContact_ContactTypeID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_VendorContact_ContactTypeID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_VendorContact_ContactID] ON [Purchasing].[VendorContact]([ContactID]) ON [PRIMARY];
CREATE INDEX [IX_VendorContact_ContactTypeID] ON [Purchasing].[VendorContact]([ContactTypeID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [IX_VendorContact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [IX_VendorContact_ContactTypeID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Purchasing], N'TABLE', [VendorContact], N'INDEX', [PK_VendorContact_VendorID_ContactID];


IX_WorkOrder_ScrapReasonID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_WorkOrder_ScrapReasonID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_WorkOrder_ScrapReasonID] ON [Production].[WorkOrder]([ScrapReasonID]) ON [PRIMARY];
CREATE INDEX [IX_WorkOrder_ProductID] ON [Production].[WorkOrder]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [IX_WorkOrder_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [IX_WorkOrder_ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [PK_WorkOrder_WorkOrderID];


IX_WorkOrder_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_WorkOrder_ProductID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_WorkOrder_ScrapReasonID] ON [Production].[WorkOrder]([ScrapReasonID]) ON [PRIMARY];
CREATE INDEX [IX_WorkOrder_ProductID] ON [Production].[WorkOrder]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [IX_WorkOrder_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [IX_WorkOrder_ScrapReasonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [WorkOrder], N'INDEX', [PK_WorkOrder_WorkOrderID];


IX_WorkOrderRouting_ProductID - Source code

Source code SQL 2005 Adventure Works OLTP

IX_WorkOrderRouting_ProductID

Summary listing Bookmark Print Locate in contents

CREATE INDEX [IX_WorkOrderRouting_ProductID] ON [Production].[WorkOrderRouting]([ProductID]) ON [PRIMARY];

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'INDEX', [IX_WorkOrderRouting_ProductID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [WorkOrderRouting], N'INDEX', [PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence];


PXML_Contact_AddContact - Source code

Source code SQL 2005 Adventure Works OLTP

PXML_Contact_AddContact

Summary listing Bookmark Print Locate in contents

SET ARITHABORT ON;
SET QUOTED_IDENTIFIER ON;
SET ANSI_NULLS ON;
SET ANSI_WARNINGS ON;
SET CONCAT_NULL_YIELDS_NULL ON;
SET NUMERIC_ROUNDABORT OFF;

CREATE PRIMARY XML INDEX [PXML_Contact_AddContact] ON [Person].[Contact]([AdditionalContactInfo]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [IX_Contact_EmailAddress];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [AK_Contact_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PK_Contact_ContactID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Person], N'TABLE', [Contact], N'INDEX', [PXML_Contact_AddContact];


PXML_Individual_Demographics - Source code

Source code SQL 2005 Adventure Works OLTP

PXML_Individual_Demographics

Summary listing Bookmark Print Locate in contents

CREATE PRIMARY XML INDEX [PXML_Individual_Demographics] ON [Sales].[Individual]([Demographics]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'INDEX', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PXML_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for path.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPATH_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for property.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPROPERTY_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for value.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLVALUE_Individual_Demographics];


XMLPATH_Individual_Demographics - Source code

Source code SQL 2005 Adventure Works OLTP

XMLPATH_Individual_Demographics

Summary listing Bookmark Print Locate in contents

CREATE XML INDEX [XMLPATH_Individual_Demographics] ON [Sales].[Individual]([Demographics])
USING XML INDEX [PXML_Individual_Demographics] FOR PATH;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'INDEX', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PXML_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for path.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPATH_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for property.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPROPERTY_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for value.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLVALUE_Individual_Demographics];


XMLPROPERTY_Individual_Demographics - Source code

Source code SQL 2005 Adventure Works OLTP

XMLPROPERTY_Individual_Demographics

Summary listing Bookmark Print Locate in contents

CREATE XML INDEX [XMLPROPERTY_Individual_Demographics] ON [Sales].[Individual]([Demographics])
USING XML INDEX [PXML_Individual_Demographics] FOR PROPERTY;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'INDEX', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PXML_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for path.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPATH_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for property.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPROPERTY_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for value.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLVALUE_Individual_Demographics];


XMLVALUE_Individual_Demographics - Source code

Source code SQL 2005 Adventure Works OLTP

XMLVALUE_Individual_Demographics

Summary listing Bookmark Print Locate in contents

CREATE XML INDEX [XMLVALUE_Individual_Demographics] ON [Sales].[Individual]([Demographics])
USING XML INDEX [PXML_Individual_Demographics] FOR VALUE;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [Illustration], N'INDEX', [PK_Illustration_IllustrationID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PK_Individual_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [PXML_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for path.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPATH_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for property.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLPROPERTY_Individual_Demographics];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Secondary XML index for value.', N'SCHEMA', [Sales], N'TABLE', [Individual], N'INDEX', [XMLVALUE_Individual_Demographics];


PXML_Store_Demographics - Source code

Source code SQL 2005 Adventure Works OLTP

PXML_Store_Demographics

Summary listing Bookmark Print Locate in contents

CREATE PRIMARY XML INDEX [PXML_Store_Demographics] ON [Sales].[Store]([Demographics]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [AK_Store_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PK_Store_CustomerID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Nonclustered index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [IX_Store_SalesPersonID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Sales], N'TABLE', [Store], N'INDEX', [PXML_Store_Demographics];


PXML_ProductModel_CatalogDescription - Source code

Source code SQL 2005 Adventure Works OLTP

PXML_ProductModel_CatalogDescription

Summary listing Bookmark Print Locate in contents

CREATE PRIMARY XML INDEX [PXML_ProductModel_CatalogDescription] ON [Production].[ProductModel]([CatalogDescription]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PK_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_CatalogDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_Instructions];


PXML_ProductModel_Instructions - Source code

Source code SQL 2005 Adventure Works OLTP

PXML_ProductModel_Instructions

Summary listing Bookmark Print Locate in contents

CREATE PRIMARY XML INDEX [PXML_ProductModel_Instructions] ON [Production].[ProductModel]([Instructions]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_Name];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Unique nonclustered index.Used to support replication samples.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [AK_ProductModel_rowguid];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index created by a primary key constraint.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PK_ProductModel_ProductModelID];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_CatalogDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Primary XML index.', N'SCHEMA', [Production], N'TABLE', [ProductModel], N'INDEX', [PXML_ProductModel_Instructions];


IX_vProductAndDescription - Source code

Source code SQL 2005 Adventure Works OLTP

IX_vProductAndDescription

Summary listing Bookmark Print Locate in contents

-- Index the vProductAndDescription view
CREATE UNIQUE CLUSTERED INDEX [IX_vProductAndDescription] ON [Production].[vProductAndDescription]([CultureID], [ProductID]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vProductAndDescription.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], N'INDEX', [IX_vProductAndDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vStateProvinceCountryRegion.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], N'INDEX', [IX_vStateProvinceCountryRegion];


IX_vStateProvinceCountryRegion - Source code

Source code SQL 2005 Adventure Works OLTP

IX_vStateProvinceCountryRegion

Summary listing Bookmark Print Locate in contents

-- Index the vStateProvinceCountryRegion view
CREATE UNIQUE CLUSTERED INDEX [IX_vStateProvinceCountryRegion] ON [Person].[vStateProvinceCountryRegion]([StateProvinceID], [CountryRegionCode]);

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vProductAndDescription.', N'SCHEMA', [Production], N'VIEW', [vProductAndDescription], N'INDEX', [IX_vProductAndDescription];
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Clustered index on the view vStateProvinceCountryRegion.', N'SCHEMA', [Person], N'VIEW', [vStateProvinceCountryRegion], N'INDEX', [IX_vStateProvinceCountryRegion];


dbo.ufnLeadingZeros - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnLeadingZeros

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnLeadingZeros](
@Value int
)
RETURNS varchar(8)
WITH SCHEMABINDING
AS
BEGIN
DECLARE @ReturnValue varchar(8);

SET @ReturnValue = CONVERT(varchar(8), @Value);
SET @ReturnValue = REPLICATE('0', 8 - DATALENGTH(@ReturnValue)) + @ReturnValue;

RETURN (@ReturnValue);
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function used by the Sales.Customer table to help set the account number.', N'SCHEMA', [dbo], N'FUNCTION', [ufnLeadingZeros], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnLeadingZeros. Enter a valid integer.', N'SCHEMA', [dbo], N'FUNCTION', [ufnLeadingZeros], N'PARAMETER', '@Value';


dbo.ufnGetAccountingStartDate - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetAccountingStartDate

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetAccountingStartDate]()
RETURNS [datetime]
AS
BEGIN
RETURN '2003-07-01';
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function used in the uSalesOrderHeader trigger to set the ending account date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetAccountingStartDate], NULL, NULL;


dbo.ufnGetAccountingEndDate - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetAccountingEndDate

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetAccountingEndDate]()
RETURNS [datetime]
AS
BEGIN
RETURN DATEADD(millisecond, -2, CONVERT(datetime, '2004-07-01', 101));
END;

-- Functions
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function used in the uSalesOrderHeader trigger to set the starting account date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetAccountingEndDate], NULL, NULL;


dbo.ufnGetContactInformation - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetContactInformation

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetContactInformation](@ContactID int)
RETURNS @retContactInformation TABLE
(
-- Columns returned by the function
[ContactID] int PRIMARY KEY NOT NULL,
[FirstName] [nvarchar](50) NULL,
[LastName] [nvarchar](50) NULL,
[JobTitle] [nvarchar](50) NULL,
[ContactType] [nvarchar](50) NULL
)
AS
-- Returns the first name, last name, job title and contact type for the specified contact.
BEGIN
DECLARE
@FirstName [nvarchar](50),
@LastName [nvarchar](50),
@JobTitle [nvarchar](50),
@ContactType [nvarchar](50);

-- Get common contact information
SELECT
@ContactID = ContactID,
@FirstName = FirstName,
@LastName = LastName
FROM [Person].[Contact]
WHERE [ContactID] = @ContactID;

SELECT @JobTitle =
CASE
-- Check for employee
WHEN EXISTS(SELECT * FROM [HumanResources].[Employee] e
WHERE e.[ContactID] = @ContactID)
THEN (SELECT [Title]
FROM [HumanResources].[Employee]
WHERE [ContactID] = @ContactID)

-- Check for vendor
WHEN EXISTS(SELECT * FROM [Purchasing].[VendorContact] vc
INNER JOIN [Person].[ContactType] ct
ON vc.[ContactTypeID] = ct.[ContactTypeID]
WHERE vc.[ContactID] = @ContactID)
THEN (SELECT ct.[Name]
FROM [Purchasing].[VendorContact] vc
INNER JOIN [Person].[ContactType] ct
ON vc.[ContactTypeID] = ct.[ContactTypeID]
WHERE vc.[ContactID] = @ContactID)

-- Check for store
WHEN EXISTS(SELECT * FROM [Sales].[StoreContact] sc
INNER JOIN [Person].[ContactType] ct
ON sc.[ContactTypeID] = ct.[ContactTypeID]
WHERE sc.[ContactID] = @ContactID)
THEN (SELECT ct.[Name]
FROM [Sales].[StoreContact] sc
INNER JOIN [Person].[ContactType] ct
ON sc.[ContactTypeID] = ct.[ContactTypeID]
WHERE [ContactID] = @ContactID)

ELSE NULL
END;

SET @ContactType =
CASE
-- Check for employee
WHEN EXISTS(SELECT * FROM [HumanResources].[Employee] e
WHERE e.[ContactID] = @ContactID)
THEN 'Employee'

-- Check for vendor
WHEN EXISTS(SELECT * FROM [Purchasing].[VendorContact] vc
INNER JOIN [Person].[ContactType] ct
ON vc.[ContactTypeID] = ct.[ContactTypeID]
WHERE vc.[ContactID] = @ContactID)
THEN 'Vendor Contact'

-- Check for store
WHEN EXISTS(SELECT * FROM [Sales].[StoreContact] sc
INNER JOIN [Person].[ContactType] ct
ON sc.[ContactTypeID] = ct.[ContactTypeID]
WHERE sc.[ContactID] = @ContactID)
THEN 'Store Contact'

-- Check for individual consumer
WHEN EXISTS(SELECT * FROM [Sales].[Individual] i
WHERE i.[ContactID] = @ContactID)
THEN 'Consumer'
END;

-- Return the information to the caller
IF @ContactID IS NOT NULL
BEGIN
INSERT @retContactInformation
SELECT @ContactID, @FirstName, @LastName, @JobTitle, @ContactType;
END;

RETURN;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Table value function returning the first name, last name, job title and contact type for a given contact.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetContactInformation], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the table value function ufnGetContactInformation. Enter a valid ContactID from the Person.Contact table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetContactInformation], N'PARAMETER', '@ContactID';


dbo.ufnGetProductDealerPrice - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetProductDealerPrice

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetProductDealerPrice](@ProductID [int], @OrderDate [datetime])
RETURNS [money]
AS
-- Returns the dealer price for the product on a specific date.
BEGIN
DECLARE @DealerPrice money;
DECLARE @DealerDiscount money;

SET @DealerDiscount = 0.60 -- 60% of list price

SELECT @DealerPrice = plph.[ListPrice] * @DealerDiscount
FROM [Production].[Product] p
INNER JOIN [Production].[ProductListPriceHistory] plph
ON p.[ProductID] = plph.[ProductID]
AND p.[ProductID] = @ProductID
AND @OrderDate BETWEEN plph.[StartDate] AND COALESCE(plph.[EndDate], '12-31-9999'); -- Make sure we get all the prices!

RETURN @DealerPrice;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the dealer price for a given product on a particular order date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductDealerPrice], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetProductDealerPrice. Enter a valid ProductID from the Production.Product table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductDealerPrice], N'PARAMETER', '@ProductID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetProductDealerPrice. Enter a valid order date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductDealerPrice], N'PARAMETER', '@OrderDate';


dbo.ufnGetProductListPrice - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetProductListPrice

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetProductListPrice](@ProductID [int], @OrderDate [datetime])
RETURNS [money]
AS
BEGIN
DECLARE @ListPrice money;

SELECT @ListPrice = plph.[ListPrice]
FROM [Production].[Product] p
INNER JOIN [Production].[ProductListPriceHistory] plph
ON p.[ProductID] = plph.[ProductID]
AND p.[ProductID] = @ProductID
AND @OrderDate BETWEEN plph.[StartDate] AND COALESCE(plph.[EndDate], '12-31-9999'); -- Make sure we get all the prices!

RETURN @ListPrice;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the list price for a given product on a particular order date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductListPrice], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetProductListPrice. Enter a valid ProductID from the Production.Product table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductListPrice], N'PARAMETER', '@ProductID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetProductListPrice. Enter a valid order date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductListPrice], N'PARAMETER', '@OrderDate';


dbo.ufnGetProductStandardCost - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetProductStandardCost

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetProductStandardCost](@ProductID [int], @OrderDate [datetime])
RETURNS [money]
AS
-- Returns the standard cost for the product on a specific date.
BEGIN
DECLARE @StandardCost money;

SELECT @StandardCost = pch.[StandardCost]
FROM [Production].[Product] p
INNER JOIN [Production].[ProductCostHistory] pch
ON p.[ProductID] = pch.[ProductID]
AND p.[ProductID] = @ProductID
AND @OrderDate BETWEEN pch.[StartDate] AND COALESCE(pch.[EndDate], '12-31-9999'); -- Make sure we get all the prices!

RETURN @StandardCost;
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the standard cost for a given product on a particular order date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductStandardCost], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid ProductID from the Production.Product table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductStandardCost], N'PARAMETER', '@ProductID';
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid order date.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetProductStandardCost], N'PARAMETER', '@OrderDate';


dbo.ufnGetStock - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetStock

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetStock](@ProductID [int])
RETURNS [int]
AS
-- Returns the stock level for the product. This function is used internally only
BEGIN
DECLARE @ret int;

SELECT @ret = SUM(p.[Quantity])
FROM [Production].[ProductInventory] p
WHERE p.[ProductID] = @ProductID
AND p.[LocationID] = '6'; -- Only look at inventory in the misc storage

IF (@ret IS NULL)
SET @ret = 0

RETURN @ret
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the quantity of inventory in LocationID 6 (Miscellaneous Storage)for a specified ProductID.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetStock], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetStock. Enter a valid ProductID from the Production.ProductInventory table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetStock], N'PARAMETER', '@ProductID';


dbo.ufnGetDocumentStatusText - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetDocumentStatusText

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetDocumentStatusText](@Status [tinyint])
RETURNS [nvarchar](15)
AS
-- Returns the sales order status text representation for the status value.
BEGIN
DECLARE @ret [nvarchar](15);

SET @ret =
CASE @Status
WHEN 1 THEN 'Pending approval'
WHEN 2 THEN 'Approved'
WHEN 3 THEN 'Obsolete'
ELSE '** Invalid **'
END;

RETURN @ret
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the text representation of the Status column in the Document table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetDocumentStatusText], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetDocumentStatusText. Enter a valid integer.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetDocumentStatusText], N'PARAMETER', '@Status';


dbo.ufnGetPurchaseOrderStatusText - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetPurchaseOrderStatusText

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetPurchaseOrderStatusText](@Status [tinyint])
RETURNS [nvarchar](15)
AS
-- Returns the sales order status text representation for the status value.
BEGIN
DECLARE @ret [nvarchar](15);

SET @ret =
CASE @Status
WHEN 1 THEN 'Pending'
WHEN 2 THEN 'Approved'
WHEN 3 THEN 'Rejected'
WHEN 4 THEN 'Complete'
ELSE '** Invalid **'
END;

RETURN @ret
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the text representation of the Status column in the PurchaseOrderHeader table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetPurchaseOrderStatusText], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetPurchaseOrdertStatusText. Enter a valid integer.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetPurchaseOrderStatusText], N'PARAMETER', '@Status';


dbo.ufnGetSalesOrderStatusText - Source code

Source code SQL 2005 Adventure Works OLTP

dbo.ufnGetSalesOrderStatusText

Summary listing Bookmark Print Locate in contents

CREATE FUNCTION [dbo].[ufnGetSalesOrderStatusText](@Status [tinyint])
RETURNS [nvarchar](15)
AS
-- Returns the sales order status text representation for the status value.
BEGIN
DECLARE @ret [nvarchar](15);

SET @ret =
CASE @Status
WHEN 1 THEN 'In process'
WHEN 2 THEN 'Approved'
WHEN 3 THEN 'Backordered'
WHEN 4 THEN 'Rejected'
WHEN 5 THEN 'Shipped'
WHEN 6 THEN 'Cancelled'
ELSE '** Invalid **'
END;

RETURN @ret
END;

EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Scalar function returning the text representation of the Status column in the SalesOrderHeader table.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetSalesOrderStatusText], NULL, NULL;
EXEC [sys].[sp_addextendedproperty] N'MS_Description', N'Input parameter for the scalar function ufnGetSalesOrderStatusText. Enter a valid integer.', N'SCHEMA', [dbo], N'FUNCTION', [ufnGetSalesOrderStatusText], N'PARAMETER', '@Status';


AccountNumber - Source code

Source code SQL 2005 Adventure Works OLTP

AccountNumber

Summary listing Bookmark Print Locate in contents

CREATE TYPE [AccountNumber] FROM nvarchar(15) NULL
CREATE TYPE [Flag] FROM bit NOT NULL
CREATE TYPE [NameStyle] FROM bit NOT NULL;
CREATE TYPE [Name] FROM nvarchar(50) NULL;
CREATE TYPE [OrderNumber] FROM nvarchar(25) NULL;
CREATE TYPE [Phone] FROM nvarchar(25) NULL;


Flag - Source code

Source code SQL 2005 Adventure Works OLTP

Flag

Summary listing Bookmark Print Locate in contents

CREATE TYPE [AccountNumber] FROM nvarchar(15) NULL
CREATE TYPE [Flag] FROM bit NOT NULL
CREATE TYPE [NameStyle] FROM bit NOT NULL;
CREATE TYPE [Name] FROM nvarchar(50) NULL;
CREATE TYPE [OrderNumber] FROM nvarchar(25) NULL;
CREATE TYPE [Phone] FROM nvarchar(25) NULL;


NameStyle - Source code

Source code SQL 2005 Adventure Works OLTP

NameStyle

Summary listing Bookmark Print Locate in contents

CREATE TYPE [AccountNumber] FROM nvarchar(15) NULL
CREATE TYPE [Flag] FROM bit NOT NULL
CREATE TYPE [NameStyle] FROM bit NOT NULL;
CREATE TYPE [Name] FROM nvarchar(50) NULL;
CREATE TYPE [OrderNumber] FROM nvarchar(25) NULL;
CREATE TYPE [Phone] FROM nvarchar(25) NULL;


Name - Source code

Source code SQL 2005 Adventure Works OLTP

Name

Summary listing Bookmark Print Locate in contents

CREATE TYPE [AccountNumber] FROM nvarchar(15) NULL
CREATE TYPE [Flag] FROM bit NOT NULL
CREATE TYPE [NameStyle] FROM bit NOT NULL;
CREATE TYPE [Name] FROM nvarchar(50) NULL;
CREATE TYPE [OrderNumber] FROM nvarchar(25) NULL;
CREATE TYPE [Phone] FROM nvarchar(25) NULL;


OrderNumber - Source code

Source code SQL 2005 Adventure Works OLTP

OrderNumber

Summary listing Bookmark Print Locate in contents

CREATE TYPE [AccountNumber] FROM nvarchar(15) NULL
CREATE TYPE [Flag] FROM bit NOT NULL
CREATE TYPE [NameStyle] FROM bit NOT NULL;
CREATE TYPE [Name] FROM nvarchar(50) NULL;
CREATE TYPE [OrderNumber] FROM nvarchar(25) NULL;
CREATE TYPE [Phone] FROM nvarchar(25) NULL;


Phone - Source code

Source code SQL 2005 Adventure Works OLTP

Phone

Summary listing Bookmark Print Locate in contents

CREATE TYPE [AccountNumber] FROM nvarchar(15) NULL
CREATE TYPE [Flag] FROM bit NOT NULL
CREATE TYPE [NameStyle] FROM bit NOT NULL;
CREATE TYPE [Name] FROM nvarchar(50) NULL;
CREATE TYPE [OrderNumber] FROM nvarchar(25) NULL;
CREATE TYPE [Phone] FROM nvarchar(25) NULL;


BOM_cte used in procedure: dbo.uspGetBillOfMaterials - Source code

Source code SQL 2005 Adventure Works OLTP

BOM_cte used in procedure: dbo.uspGetBillOfMaterials

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetBillOfMaterials]
@StartProductID [int],
@CheckDate [datetime]
AS
BEGIN
SET NOCOUNT ON;

-- Use recursive query to generate a multi-level Bill of Material (i.e. all level 1
-- components of a level 0 assembly, all level 2 components of a level 1 assembly)
-- The CheckDate eliminates any components that are no longer used in the product on this date.
WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], [RecursionLevel]) -- CTE name and columns
AS (
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get the initial list of components for the bike assembly
FROM [Production].[BillOfMaterials] b
INNER JOIN [Production].[Product] p
ON b.[ComponentID] = p.[ProductID]
WHERE b.[ProductAssemblyID] = @StartProductID
AND @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
UNION ALL
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [BOM_cte] cte
INNER JOIN [Production].[BillOfMaterials] b
ON b.[ProductAssemblyID] = cte.[ComponentID]
INNER JOIN [Production].[Product] p
ON b.[ComponentID] = p.[ProductID]
WHERE @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
)
-- Outer select from the CTE
SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], b.[ListPrice], b.[BOMLevel], b.[RecursionLevel]
FROM [BOM_cte] b
GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.[ListPrice]
ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID]
OPTION (MAXRECURSION 25)
END;


EMP_cte used in procedure: dbo.uspGetEmployeeManagers - Source code

Source code SQL 2005 Adventure Works OLTP

EMP_cte used in procedure: dbo.uspGetEmployeeManagers

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetEmployeeManagers]
@EmployeeID [int]
AS
BEGIN
SET NOCOUNT ON;

-- Use recursive query to list out all Employees required for a particular Manager
WITH [EMP_cte]([EmployeeID], [ManagerID], [FirstName], [LastName], [Title], [RecursionLevel]) -- CTE name and columns
AS (
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], e.[Title], 0 -- Get the initial Employee
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
WHERE e.[EmployeeID] = @EmployeeID
UNION ALL
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], e.[Title], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [HumanResources].[Employee] e
INNER JOIN [EMP_cte]
ON e.[EmployeeID] = [EMP_cte].[ManagerID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
)
-- Join back to Employee to return the manager name
SELECT [EMP_cte].[RecursionLevel], [EMP_cte].[EmployeeID], [EMP_cte].[FirstName], [EMP_cte].[LastName],
[EMP_cte].[ManagerID], c.[FirstName] AS 'ManagerFirstName', c.[LastName] AS 'ManagerLastName' -- Outer select from the CTE
FROM [EMP_cte]
INNER JOIN [HumanResources].[Employee] e
ON [EMP_cte].[ManagerID] = e.[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
ORDER BY [RecursionLevel], [ManagerID], [EmployeeID]
OPTION (MAXRECURSION 25)
END;


EMP_cte used in procedure: dbo.uspGetManagerEmployees - Source code

Source code SQL 2005 Adventure Works OLTP

EMP_cte used in procedure: dbo.uspGetManagerEmployees

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetManagerEmployees]
@ManagerID [int]
AS
BEGIN
SET NOCOUNT ON;

-- Use recursive query to list out all Employees required for a particular Manager
WITH [EMP_cte]([EmployeeID], [ManagerID], [FirstName], [LastName], [RecursionLevel]) -- CTE name and columns
AS (
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], 0 -- Get the initial list of Employees for Manager n
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
WHERE [ManagerID] = @ManagerID
UNION ALL
SELECT e.[EmployeeID], e.[ManagerID], c.[FirstName], c.[LastName], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [HumanResources].[Employee] e
INNER JOIN [EMP_cte]
ON e.[ManagerID] = [EMP_cte].[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
)
-- Join back to Employee to return the manager name
SELECT [EMP_cte].[RecursionLevel], [EMP_cte].[ManagerID], c.[FirstName] AS 'ManagerFirstName', c.[LastName] AS 'ManagerLastName',
[EMP_cte].[EmployeeID], [EMP_cte].[FirstName], [EMP_cte].[LastName] -- Outer select from the CTE
FROM [EMP_cte]
INNER JOIN [HumanResources].[Employee] e
ON [EMP_cte].[ManagerID] = e.[EmployeeID]
INNER JOIN [Person].[Contact] c
ON e.[ContactID] = c.[ContactID]
ORDER BY [RecursionLevel], [ManagerID], [EmployeeID]
OPTION (MAXRECURSION 25)
END;


BOM_cte used in procedure: dbo.uspGetWhereUsedProductID - Source code

Source code SQL 2005 Adventure Works OLTP

BOM_cte used in procedure: dbo.uspGetWhereUsedProductID

Summary listing Bookmark Print Locate in contents

CREATE PROCEDURE [dbo].[uspGetWhereUsedProductID]
@StartProductID [int],
@CheckDate [datetime]
AS
BEGIN
SET NOCOUNT ON;

--Use recursive query to generate a multi-level Bill of Material (i.e. all level 1 components of a level 0 assembly, all level 2 components of a level 1 assembly)
WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], [RecursionLevel]) -- CTE name and columns
AS (
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get the initial list of components for the bike assembly
FROM [Production].[BillOfMaterials] b
INNER JOIN [Production].[Product] p
ON b.[ProductAssemblyID] = p.[ProductID]
WHERE b.[ComponentID] = @StartProductID
AND @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
UNION ALL
SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], [RecursionLevel] + 1 -- Join recursive member to anchor
FROM [BOM_cte] cte
INNER JOIN [Production].[BillOfMaterials] b
ON cte.[ProductAssemblyID] = b.[ComponentID]
INNER JOIN [Production].[Product] p
ON b.[ProductAssemblyID] = p.[ProductID]
WHERE @CheckDate >= b.[StartDate]
AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate)
)
-- Outer select from the CTE
SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], b.[ListPrice], b.[BOMLevel], b.[RecursionLevel]
FROM [BOM_cte] b
GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.[ListPrice]
ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID]
OPTION (MAXRECURSION 25)
END;


Company Sales - Source code

Source code SQL 2005 Adventure Works OLTP

Company Sales

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: Sales ***** */

SET DATEFORMAT mdy
SELECT PC.Name AS ProdCat, PS.Name AS SubCat, DATEPART(yy, SOH.OrderDate) AS OrderYear, 'Q' + DATENAME(qq, SOH.OrderDate) AS OrderQtr,
SUM(SOD.UnitPrice * SOD.OrderQty) AS Sales
FROM Production.ProductSubcategory PS INNER JOIN
Sales.SalesOrderHeader SOH INNER JOIN
Sales.SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID INNER JOIN
Production.Product P ON SOD.ProductID = P.ProductID ON PS.ProductSubcategoryID = P.ProductSubcategoryID INNER JOIN
Production.ProductCategory PC ON PS.ProductCategoryID = PC.ProductCategoryID
WHERE (SOH.OrderDate BETWEEN '1/1/2002' AND '12/31/2003')
GROUP BY DATEPART(yy, SOH.OrderDate), PC.Name, PS.Name, 'Q' + DATENAME(qq, SOH.OrderDate), PS.ProductSubcategoryID


Employee Sales Summary - Source code

Source code SQL 2005 Adventure Works OLTP

Employee Sales Summary

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: EmpSalesYearOverYear ***** */

SELECT C.FirstName + ' ' + C.LastName AS Employee, DATEPART(Year, SOH.OrderDate) AS OrderYear,
DATEPART(Month, SOH.OrderDate) AS OrderMonthNum, DATENAME(Month, SOH.OrderDate) AS OrderMonth, SUM(SOD.LineTotal) AS Sales
FROM Sales.SalesOrderHeader SOH INNER JOIN
Sales.SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID INNER JOIN
Sales.SalesPerson SP ON SOH.SalesPersonID = SP.SalesPersonID INNER JOIN
HumanResources.Employee E ON SP.SalesPersonID = E.EmployeeID INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID
WHERE (DATEPART(Year, SOH.OrderDate) <= @ReportYear - 1 OR
DATEPART(Year, SOH.OrderDate) = @ReportYear AND DATEPART(Month, SOH.OrderDate) <= @ReportMonth) AND
(SOH.SalesPersonID = @EmpID)
GROUP BY C.FirstName + ' ' + C.LastName, SOH.SalesPersonID, DATEPART(Year, SOH.OrderDate),
DATEPART(Month, SOH.OrderDate), DATENAME(Month, SOH.OrderDate)

/* ***** Source for query: SalesEmps ***** */

SELECT E.EmployeeID, C.FirstName + N' ' + C.LastName AS Employee
FROM HumanResources.Employee E INNER JOIN
Sales.SalesPerson SP ON E.EmployeeID = SP.SalesPersonID INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID
ORDER BY C.LastName, C.FirstName

/* ***** Source for query: EmpSalesMonth ***** */

SELECT C.FirstName + ' ' + C.LastName AS Employee, DATEPART(Year, SOH.OrderDate) AS OrderYear,
DATEPART(Month, SOH.OrderDate) AS OrderMonthNum, DATENAME(Month, SOH.OrderDate) AS OrderMonth,
PC.Name AS ProdCat, SUM(SOD.LineTotal) AS Sales
FROM Sales.SalesOrderHeader SOH INNER JOIN
Sales.SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID INNER JOIN
Sales.SalesPerson SP ON SOH.SalesPersonID = SP.SalesPersonID INNER JOIN
HumanResources.Employee E ON SP.SalesPersonID = E.EmployeeID INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID INNER JOIN
Production.Product P ON SOD.ProductID = P.ProductID INNER JOIN
Production.ProductSubcategory PS ON P.ProductSubcategoryID = PS.ProductSubcategoryID INNER JOIN
Production.ProductCategory PC ON PS.ProductCategoryID = PC.ProductCategoryID
WHERE (DATEPART(Year, SOH.OrderDate) <= @ReportYear) AND (DATEPART(Month, SOH.OrderDate) = @ReportMonth) AND
(SOH.SalesPersonID = @EmpID)
GROUP BY C.FirstName + ' ' + C.LastName, DATEPART(Year, SOH.OrderDate), DATEPART(Month, SOH.OrderDate),
DATENAME(Month, SOH.OrderDate), PC.Name

/* ***** Source for query: EmpSalesDetail ***** */

SELECT C.FirstName + ' ' + C.LastName AS Employee, DATEPART(Month, SOH.OrderDate) AS OrderMonthNum,
PS.Name AS SubCat, SUM(SOD.LineTotal) AS Sales, SOH.SalesOrderNumber, P.Name AS Product,
SUM(SOD.OrderQty) AS OrderQty, SOD.UnitPrice, PC.Name AS ProdCat
FROM Sales.SalesOrderHeader SOH INNER JOIN
Sales.SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID INNER JOIN
Sales.SalesPerson SP ON SOH.SalesPersonID = SP.SalesPersonID INNER JOIN
HumanResources.Employee E ON SP.SalesPersonID = E.EmployeeID INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID INNER JOIN
Production.Product P ON SOD.ProductID = P.ProductID INNER JOIN
Production.ProductSubcategory PS ON P.ProductSubcategoryID = PS.ProductSubcategoryID INNER JOIN
Production.ProductCategory PC ON PS.ProductCategoryID = PC.ProductCategoryID
WHERE (DATEPART(Year, SOH.OrderDate) = @ReportYear) AND (DATEPART(Month, SOH.OrderDate) = @ReportMonth) AND
(SOH.SalesPersonID = @EmpID)
GROUP BY C.FirstName + ' ' + C.LastName, DATEPART(Month, SOH.OrderDate), SOH.SalesOrderNumber,
P.Name, PS.Name, SOD.UnitPrice, PC.Name


Product Catalog - Source code

Source code SQL 2005 Adventure Works OLTP

Product Catalog

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: ProductCatalog ***** */

SELECT PS.Name AS ProdSubCat, PM.Name AS ProdModel, PC.Name AS ProdCat, PD.Description, PP.LargePhoto, P.Name AS ProdName, P.ProductNumber,
P.Color, P.Size, P.Weight, P.StandardCost, P.Style, P.Class, P.ListPrice
FROM Production.Product P INNER JOIN
Production.ProductSubcategory PS INNER JOIN
Production.ProductCategory PC ON PS.ProductCategoryID = PC.ProductCategoryID ON P.ProductSubcategoryID = PS.ProductSubcategoryID INNER JOIN
Production.ProductProductPhoto PPP ON P.ProductID = PPP.ProductID INNER JOIN
Production.ProductPhoto PP ON PPP.ProductPhotoID = PP.ProductPhotoID LEFT OUTER JOIN
Production.ProductDescription PD INNER JOIN
Production.ProductModel PM INNER JOIN
Production.ProductModelProductDescriptionCulture PMPDCL ON PM.ProductModelID = PMPDCL.ProductModelID ON
PD.ProductDescriptionID = PMPDCL.ProductDescriptionID ON P.ProductModelID = PM.ProductModelID
WHERE (PMPDCL.CultureID = @Language)


Product Line Sales - Source code

Source code SQL 2005 Adventure Works OLTP

Product Line Sales

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: TopEmployees ***** */

SELECT TOP 5 C.LastName, C.FirstName, E.EmployeeID, SUM(SOH.SubTotal) AS SaleAmount
FROM Sales.SalesPerson SP INNER JOIN
HumanResources.Employee E ON SP.SalesPersonID = E.EmployeeID INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID INNER JOIN
Sales.SalesOrderHeader SOH ON SP.SalesPersonID = SOH.SalesPersonID INNER JOIN
Sales.SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID INNER JOIN
Production.Product P ON SOD.ProductID = P.ProductID INNER JOIN
Production.ProductSubcategory PS ON P.ProductSubcategoryID = PS.ProductSubcategoryID INNER JOIN
Production.ProductCategory PC ON PS.ProductCategoryID = PC.ProductCategoryID
WHERE (PC.ProductCategoryID = @ProductCategory) AND (PS.ProductSubcategoryID IN (@ProductSubcategory)) AND
(SOH.OrderDate > @StartDate) AND (SOH.OrderDate < @EndDate)
GROUP BY C.LastName, C.FirstName, E.EmployeeID, PC.ProductCategoryID, PS.ProductSubcategoryID

/* ***** Source for query: ProductCategories ***** */

SELECT DISTINCT ProductCategoryID, Name
FROM Production.ProductCategory
ORDER BY Name

/* ***** Source for query: TopCustomers ***** */

SELECT TOP 5 S.Name AS StoreName, SUM(SOH.SubTotal) AS SaleAmount, PS.ProductSubcategoryID,
PS.ProductCategoryID
FROM Production.Product P INNER JOIN
Production.ProductSubcategory PS ON P.ProductSubCategoryID = PS.ProductSubCategoryID INNER JOIN
Sales.SalesOrderDetail SOD ON P.ProductID = SOD.ProductID INNER JOIN
Sales.Customer CU INNER JOIN
Sales.SalesOrderHeader SOH ON CU.CustomerID = SOH.CustomerID INNER JOIN
Sales.Store S ON CU.CustomerID = S.CustomerID ON SOD.SalesOrderID = SOH.SalesOrderID
WHERE (SOH.OrderDate > @StartDate) AND
(SOH.OrderDate < @EndDate) AND (PS.ProductCategoryID = @ProductCategory) AND (PS.ProductSubcategoryID IN (@ProductSubcategory))
GROUP BY S.Name, PS.ProductSubcategoryID, PS.ProductCategoryID
ORDER BY SUM(SOH.SubTotal) DESC

/* ***** Source for query: ProductSubCategories ***** */

SELECT ProductSubcategoryID, ProductCategoryID, Name
FROM Production.ProductSubcategory
WHERE (ProductCategoryID = @ProductCategory)


Sales Order Detail - Source code

Source code SQL 2005 Adventure Works OLTP

Sales Order Detail

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: SalesOrder ***** */

SELECT SOH.SalesOrderNumber, S.Name AS Store, SOH.OrderDate, C.FirstName AS SalesFirstName, C.LastName AS SalesLastName, E.Title AS SalesTitle,
SOH.PurchaseOrderNumber, SM.Name AS ShipMethod, BA.AddressLine1 AS BillAddress1, BA.AddressLine2 AS BillAddress2, BA.City AS BillCity,
BA.PostalCode AS BillPostalCode, BSP.Name AS BillStateProvince, BCR.Name AS BillCountryRegion,
SA.AddressLine1 AS ShipAddress1, SA.AddressLine2 AS ShipAddress2, SA.City AS ShipCity, SA.PostalCode AS ShipPostalCode,
SSP.Name AS ShipStateProvince, SCR.Name AS ShipCountryRegion, CC.Phone AS CustPhone,
CC.FirstName AS CustFirstName, CC.LastName AS CustLastName
FROM Person.Address SA INNER JOIN
Person.StateProvince SSP ON SA.StateProvinceID = SSP.StateProvinceID INNER JOIN
Person.CountryRegion SCR ON SSP.CountryRegionCode = SCR.CountryRegionCode RIGHT OUTER JOIN
Sales.SalesOrderHeader SOH LEFT OUTER JOIN
Person.Contact CC ON SOH.ContactID = CC.ContactID LEFT OUTER JOIN
Person.Address BA INNER JOIN
Person.StateProvince BSP ON BA.StateProvinceID = BSP.StateProvinceID INNER JOIN
Person.CountryRegion BCR ON BSP.CountryRegionCode = BCR.CountryRegionCode ON SOH.BillToAddressID = BA.AddressID ON
SA.AddressID = SOH.ShipToAddressID LEFT OUTER JOIN
Person.Contact C RIGHT OUTER JOIN
HumanResources.Employee E ON C.ContactID = E.ContactID ON SOH.SalesPersonID = E.EmployeeID LEFT OUTER JOIN
Purchasing.ShipMethod SM ON SOH.ShipMethodID = SM.ShipMethodID LEFT OUTER JOIN
Sales.Store S ON SOH.CustomerID = S.CustomerID
WHERE (SOH.SalesOrderNumber = @SalesOrderNumber)

/* ***** Source for query: SalesOrderDetail ***** */

SELECT SOD.SalesOrderDetailID, SOD.OrderQty, SOD.UnitPrice,
CASE WHEN SOD.UnitPriceDiscount IS NULL THEN 0 ELSE SOD.UnitPriceDiscount END AS UnitPriceDiscount,
SOD.LineTotal, SOD.CarrierTrackingNumber, SOD.SalesOrderID, P.Name, P.ProductNumber
FROM Sales.SalesOrderDetail SOD INNER JOIN
Production.Product P ON SOD.ProductID = P.ProductID INNER JOIN
Sales.SalesOrderHeader SOH ON SOD.SalesOrderID = SOH.SalesOrderID
WHERE (SOH.SalesOrderNumber = @SalesOrderNumber)
ORDER BY SOD.SalesOrderDetailID


Sales Reason Comparisons - Source code

Source code SQL 2005 Adventure Works OLTP

Sales Reason Comparisons

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: ProductData ***** */

WITH MEMBER [Measures].[Profit] AS '[Measures].[Sales Amount]-[Measures].[Standard Product Cost]' SELECT NON EMPTY { [Measures].[Internet Sales Amount], [Measures].[Internet Total Product Cost], [Measures].[Internet Order Quantity] } ON COLUMNS, NON EMPTY { ([Sales Reason].[Sales Reason].[Sales Reason].ALLMEMBERS * [Sales Territory].[Sales Territory Group].[Sales Territory Group].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, [Sales Reason].[Sales Reason].[Sales Reason].KEY, [Sales Territory].[Sales Territory Group].[Sales Territory Group].KEY ON ROWS FROM ( SELECT ( STRTOSET(@ProductCategory, CONSTRAINED) ) ON COLUMNS FROM [Adventure Works]) WHERE ( IIF( STRTOSET(@ProductCategory, CONSTRAINED).Count = 1, STRTOSET(@ProductCategory, CONSTRAINED), [Product].[Category].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

/* ***** Source for query: ProductList ***** */

WITH MEMBER [Measures].[ParameterCaption] AS '[Product].[Category].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Product].[Category].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Product].[Category].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Product].[Category].ALLMEMBERS ON ROWS FROM [Adventure Works]


Territory Sales Drilldown - Source code

Source code SQL 2005 Adventure Works OLTP

Territory Sales Drilldown

Summary listing Bookmark Print Locate in contents

/* ***** Source for query: TerritorySales ***** */

SELECT ST.Name, SP.SalesPersonID, C.FirstName, C.LastName, SOH.SalesOrderNumber, SOH.TotalDue
FROM Sales.SalesTerritory ST INNER JOIN
Sales.SalesPerson SP ON ST.TerritoryID = SP.TerritoryID INNER JOIN
HumanResources.Employee E ON SP.SalesPersonID = E.EmployeeID INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID INNER JOIN
Sales.SalesOrderHeader SOH ON SP.SalesPersonID = SOH.SalesPersonID
GROUP BY ST.Name, SP.SalesPersonID, C.FirstName, C.LastName, SOH.SalesOrderNumber, SOH.TotalDue
ORDER BY ST.Name