-----------------------------------------
-- 12.12.2011 22:03:33 MS_Description  
-----------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', default, default, default, default, default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'AdventureWorks Sample OLTP Database', @level0type = default, @level0name = default, @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'AdventureWorks Sample OLTP Database', @level0type = default, @level0name = default, @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
GO
----------------------------------------------------------------------
-- 12.12.2011 22:03:33 MS_Description for SCHEMA = HumanResources;  
----------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', default, default, default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Contains objects related to employees and departments.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Contains objects related to employees and departments.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
GO
--------------------------------------------------------------
-- 12.12.2011 22:03:33 MS_Description for SCHEMA = Person;  
--------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', default, default, default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Contains objects related to names and addresses of customers, vendors, and employees', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Contains objects related to names and addresses of customers, vendors, and employees', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
GO
------------------------------------------------------------------
-- 12.12.2011 22:03:33 MS_Description for SCHEMA = Production;  
------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', default, default, default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Contains objects related to products, inventory, and manufacturing.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Contains objects related to products, inventory, and manufacturing.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
GO
------------------------------------------------------------------
-- 12.12.2011 22:03:33 MS_Description for SCHEMA = Purchasing;  
------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Purchasing', default, default, default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Contains objects related to vendors and purchase orders.', @level0type = N'SCHEMA', @level0name = N'Purchasing', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Contains objects related to vendors and purchase orders.', @level0type = N'SCHEMA', @level0name = N'Purchasing', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------
-- 12.12.2011 22:03:33 MS_Description for SCHEMA = Sales;  
-------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Sales', default, default, default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Contains objects related to customers, sales orders, and sales territories.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Contains objects related to customers, sales orders, and sales territories.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = default, @level1name = default, @level2type = default, @level2name = default
END
GO
----------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = AWBuildVersion; 
----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'AWBuildVersion', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Current version number of the AdventureWorks sample database. ', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Current version number of the AdventureWorks sample database. ', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = AWBuildVersion; COLUMN = SystemInformationID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'AWBuildVersion', N'COLUMN', N'SystemInformationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for AWBuildVersion records.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'SystemInformationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for AWBuildVersion records.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'SystemInformationID'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = AWBuildVersion; COLUMN = Database Version;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'AWBuildVersion', N'COLUMN', N'Database Version'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Version number of the database in 9.yy.mm.dd.00 format.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'Database Version'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Version number of the database in 9.yy.mm.dd.00 format.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'Database Version'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = AWBuildVersion; COLUMN = VersionDate;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'AWBuildVersion', N'COLUMN', N'VersionDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'VersionDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'VersionDate'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = AWBuildVersion; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'AWBuildVersion', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = AWBuildVersion; CONSTRAINT = PK_AWBuildVersion_SystemInformationID;
-------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'AWBuildVersion', N'CONSTRAINT', N'PK_AWBuildVersion_SystemInformationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'CONSTRAINT', @level2name = N'PK_AWBuildVersion_SystemInformationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AWBuildVersion', @level2type = N'CONSTRAINT', @level2name = N'PK_AWBuildVersion_SystemInformationID'
END
GO
-------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; 
-------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = default, @level2name = default
END
GO
------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = DatabaseLogID;
------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'DatabaseLogID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for DatabaseLog records.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'DatabaseLogID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for DatabaseLog records.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'DatabaseLogID'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = PostTime;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'PostTime'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The date and time the DDL change occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'PostTime'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The date and time the DDL change occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'PostTime'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = DatabaseUser;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'DatabaseUser'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The user who implemented the DDL change.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'DatabaseUser'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The user who implemented the DDL change.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'DatabaseUser'
END
GO
----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = Event;
----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'Event'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The type of DDL statement that was executed.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'Event'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The type of DDL statement that was executed.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'Event'
END
GO
-----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = Schema;
-----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'Schema'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The schema to which the changed object belongs.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'Schema'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The schema to which the changed object belongs.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'Schema'
END
GO
-----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = Object;
-----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'Object'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The object that was changed by the DDL statment.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'Object'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The object that was changed by the DDL statment.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'Object'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = TSQL;
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'TSQL'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The exact Transact-SQL statement that was executed.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'TSQL'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The exact Transact-SQL statement that was executed.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'TSQL'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; COLUMN = XmlEvent;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'COLUMN', N'XmlEvent'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The raw XML data generated by database trigger.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'XmlEvent'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The raw XML data generated by database trigger.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'COLUMN', @level2name = N'XmlEvent'
END
GO
-------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = DatabaseLog; CONSTRAINT = PK_DatabaseLog_DatabaseLogID;
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'DatabaseLog', N'CONSTRAINT', N'PK_DatabaseLog_DatabaseLogID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (nonclustered) constraint', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'CONSTRAINT', @level2name = N'PK_DatabaseLog_DatabaseLogID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (nonclustered) constraint', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DatabaseLog', @level2type = N'CONSTRAINT', @level2name = N'PK_DatabaseLog_DatabaseLogID'
END
GO
----------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; 
----------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Audit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Audit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = default, @level2name = default
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorLogID;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorLogID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ErrorLog records.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorLogID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ErrorLog records.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorLogID'
END
GO
-----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorTime;
-----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorTime'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The date and time at which the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorTime'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The date and time at which the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorTime'
END
GO
----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = UserName;
----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'UserName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The user who executed the batch in which the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'UserName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The user who executed the batch in which the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'UserName'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorNumber;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorNumber'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The error number of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorNumber'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The error number of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorNumber'
END
GO
---------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorSeverity;
---------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorSeverity'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The severity of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorSeverity'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The severity of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorSeverity'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorState;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorState'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The state number of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorState'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The state number of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorState'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorProcedure;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorProcedure'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The name of the stored procedure or trigger where the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorProcedure'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The name of the stored procedure or trigger where the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorProcedure'
END
GO
-----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorLine;
-----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorLine'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The line number at which the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorLine'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The line number at which the error occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorLine'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; COLUMN = ErrorMessage;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'COLUMN', N'ErrorMessage'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'The message text of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorMessage'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'The message text of the error that occurred.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'COLUMN', @level2name = N'ErrorMessage'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = dbo; TABLE = ErrorLog; CONSTRAINT = PK_ErrorLog_ErrorLogID;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'dbo', N'TABLE', N'ErrorLog', N'CONSTRAINT', N'PK_ErrorLog_ErrorLogID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'CONSTRAINT', @level2name = N'PK_ErrorLog_ErrorLogID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ErrorLog', @level2type = N'CONSTRAINT', @level2name = N'PK_ErrorLog_ErrorLogID'
END
GO
-----------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; 
-----------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the departments within the Adventure Works Cycles company.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the departments within the Adventure Works Cycles company.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; COLUMN = DepartmentID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', N'COLUMN', N'DepartmentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Department records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'DepartmentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Department records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'DepartmentID'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; COLUMN = Name;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Name of the department.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Name of the department.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; COLUMN = GroupName;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', N'COLUMN', N'GroupName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Name of the group to which the department belongs.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'GroupName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Name of the group to which the department belongs.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'GroupName'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; COLUMN = ModifiedDate;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; INDEX = AK_Department_Name;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', N'INDEX', N'AK_Department_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'INDEX', @level2name = N'AK_Department_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'INDEX', @level2name = N'AK_Department_Name'
END
GO
---------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Department; CONSTRAINT = PK_Department_DepartmentID;
---------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Department', N'CONSTRAINT', N'PK_Department_DepartmentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'CONSTRAINT', @level2name = N'PK_Department_DepartmentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'CONSTRAINT', @level2name = N'PK_Department_DepartmentID'
END
GO
---------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; 
---------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee information such as salary, department, and title.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee information such as salary, department, and title.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = default, @level2name = default
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = EmployeeID;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Employee records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Employee records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = NationalIDNumber;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'NationalIDNumber'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique national identification number such as a social security number.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'NationalIDNumber'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique national identification number such as a social security number.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'NationalIDNumber'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = ContactID;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'ContactID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Identifies the employee in the Contact table. Foreign key to Contact.ContactID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'ContactID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Identifies the employee in the Contact table. Foreign key to Contact.ContactID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'ContactID'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = LoginID;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'LoginID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Network login.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'LoginID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Network login.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'LoginID'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = ManagerID;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'ManagerID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Manager to whom the employee is assigned. Foreign Key to Employee.M', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'ManagerID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Manager to whom the employee is assigned. Foreign Key to Employee.M', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'ManagerID'
END
GO
------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = Title;
------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'Title'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Work title such as Buyer or Sales Representative.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'Title'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Work title such as Buyer or Sales Representative.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'Title'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = BirthDate;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'BirthDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date of birth.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'BirthDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date of birth.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'BirthDate'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = MaritalStatus;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'MaritalStatus'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'M = Married, S = Single', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'MaritalStatus'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'M = Married, S = Single', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'MaritalStatus'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = Gender;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'Gender'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'M = Male, F = Female', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'Gender'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'M = Male, F = Female', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'Gender'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = HireDate;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'HireDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee hired on this date.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'HireDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee hired on this date.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'HireDate'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = SalariedFlag;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'SalariedFlag'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'SalariedFlag'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'SalariedFlag'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = VacationHours;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'VacationHours'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Number of available vacation hours.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'VacationHours'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Number of available vacation hours.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'VacationHours'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = SickLeaveHours;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'SickLeaveHours'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Number of available sick leave hours.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'SickLeaveHours'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Number of available sick leave hours.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'SickLeaveHours'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = CurrentFlag;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'CurrentFlag'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0 = Inactive, 1 = Active', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'CurrentFlag'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0 = Inactive, 1 = Active', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'CurrentFlag'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = rowguid;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; INDEX = AK_Employee_LoginID;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'INDEX', N'AK_Employee_LoginID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'AK_Employee_LoginID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'AK_Employee_LoginID'
END
GO
----------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; INDEX = AK_Employee_NationalIDNumber;
----------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'INDEX', N'AK_Employee_NationalIDNumber'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'AK_Employee_NationalIDNumber'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'AK_Employee_NationalIDNumber'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; INDEX = AK_Employee_rowguid;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'INDEX', N'AK_Employee_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'AK_Employee_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'AK_Employee_rowguid'
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; INDEX = IX_Employee_ManagerID;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'INDEX', N'IX_Employee_ManagerID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'IX_Employee_ManagerID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'INDEX', @level2name = N'IX_Employee_ManagerID'
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; CONSTRAINT = PK_Employee_EmployeeID;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'CONSTRAINT', N'PK_Employee_EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'CONSTRAINT', @level2name = N'PK_Employee_EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'CONSTRAINT', @level2name = N'PK_Employee_EmployeeID'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Employee; TRIGGER = dEmployee;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Employee', N'TRIGGER', N'dEmployee'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'TRIGGER', @level2name = N'dEmployee'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'INSTEAD OF DELETE trigger which keeps Employees from being deleted.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Employee', @level2type = N'TRIGGER', @level2name = N'dEmployee'
END
GO
----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; 
----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping employees to their address(es).', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping employees to their address(es).', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = default, @level2name = default
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; COLUMN = EmployeeID;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', N'COLUMN', N'EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; COLUMN = AddressID;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', N'COLUMN', N'AddressID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to Address.AddressID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'AddressID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to Address.AddressID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'AddressID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; COLUMN = rowguid;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
---------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; INDEX = AK_EmployeeAddress_rowguid;
---------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', N'INDEX', N'AK_EmployeeAddress_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'INDEX', @level2name = N'AK_EmployeeAddress_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'INDEX', @level2name = N'AK_EmployeeAddress_rowguid'
END
GO
---------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeAddress; CONSTRAINT = PK_EmployeeAddress_EmployeeID_AddressID;
---------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeAddress', N'CONSTRAINT', N'PK_EmployeeAddress_EmployeeID_AddressID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'CONSTRAINT', @level2name = N'PK_EmployeeAddress_EmployeeID_AddressID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeAddress', @level2type = N'CONSTRAINT', @level2name = N'PK_EmployeeAddress_EmployeeID_AddressID'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; 
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee department transfers.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee department transfers.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = default, @level2name = default
END
GO
----------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; COLUMN = EmployeeID;
----------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'COLUMN', N'EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee identification number. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee identification number. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
GO
------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; COLUMN = DepartmentID;
------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'COLUMN', N'DepartmentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Department in which the employee worked including currently. Foreign key to Department.DepartmentID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'DepartmentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Department in which the employee worked including currently. Foreign key to Department.DepartmentID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'DepartmentID'
END
GO
-------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; COLUMN = ShiftID;
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'COLUMN', N'ShiftID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'ShiftID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'ShiftID'
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; COLUMN = StartDate;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'COLUMN', N'StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the employee started work in the department.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the employee started work in the department.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'StartDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; COLUMN = EndDate;
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'COLUMN', N'EndDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the employee left the department. NULL = Current department.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'EndDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the employee left the department. NULL = Current department.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'EndDate'
END
GO
------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; COLUMN = ModifiedDate;
------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
----------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; INDEX = IX_EmployeeDepartmentHistory_DepartmentID;
----------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'INDEX', N'IX_EmployeeDepartmentHistory_DepartmentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'INDEX', @level2name = N'IX_EmployeeDepartmentHistory_DepartmentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'INDEX', @level2name = N'IX_EmployeeDepartmentHistory_DepartmentID'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; INDEX = IX_EmployeeDepartmentHistory_ShiftID;
-----------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'INDEX', N'IX_EmployeeDepartmentHistory_ShiftID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'INDEX', @level2name = N'IX_EmployeeDepartmentHistory_ShiftID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'INDEX', @level2name = N'IX_EmployeeDepartmentHistory_ShiftID'
END
GO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeeDepartmentHistory; CONSTRAINT = PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeeDepartmentHistory', N'CONSTRAINT', N'PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeeDepartmentHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_EmployeeDepartmentHistory_EmployeeID_StartDate_DepartmentID'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; 
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee pay history.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee pay history.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; COLUMN = EmployeeID;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', N'COLUMN', N'EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee identification number. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee identification number. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
GO
-------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; COLUMN = RateChangeDate;
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', N'COLUMN', N'RateChangeDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the change in pay is effective', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'RateChangeDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the change in pay is effective', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'RateChangeDate'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; COLUMN = Rate;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', N'COLUMN', N'Rate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Salary hourly rate.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'Rate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Salary hourly rate.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'Rate'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; COLUMN = PayFrequency;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', N'COLUMN', N'PayFrequency'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'1 = Salary received monthly, 2 = Salary received biweekly', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'PayFrequency'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'1 = Salary received monthly, 2 = Salary received biweekly', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'PayFrequency'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; COLUMN = ModifiedDate;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = EmployeePayHistory; CONSTRAINT = PK_EmployeePayHistory_EmployeeID_RateChangeDate;
--------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'EmployeePayHistory', N'CONSTRAINT', N'PK_EmployeePayHistory_EmployeeID_RateChangeDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_EmployeePayHistory_EmployeeID_RateChangeDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'EmployeePayHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_EmployeePayHistory_EmployeeID_RateChangeDate'
END
GO
-------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; 
-------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Résumés submitted to Human Resources by job applicants.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Résumés submitted to Human Resources by job applicants.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; COLUMN = JobCandidateID;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', N'COLUMN', N'JobCandidateID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for JobCandidate records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'JobCandidateID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for JobCandidate records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'JobCandidateID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; COLUMN = EmployeeID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', N'COLUMN', N'EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Employee identification number if applicant was hired. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Employee identification number if applicant was hired. Foreign key to Employee.EmployeeID.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'EmployeeID'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; COLUMN = Resume;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', N'COLUMN', N'Resume'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Résumé in XML format.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'Resume'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Résumé in XML format.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'Resume'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; COLUMN = ModifiedDate;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; INDEX = IX_JobCandidate_EmployeeID;
------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', N'INDEX', N'IX_JobCandidate_EmployeeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'INDEX', @level2name = N'IX_JobCandidate_EmployeeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'INDEX', @level2name = N'IX_JobCandidate_EmployeeID'
END
GO
---------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = JobCandidate; CONSTRAINT = PK_JobCandidate_JobCandidateID;
---------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'JobCandidate', N'CONSTRAINT', N'PK_JobCandidate_JobCandidateID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'CONSTRAINT', @level2name = N'PK_JobCandidate_JobCandidateID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'JobCandidate', @level2type = N'CONSTRAINT', @level2name = N'PK_JobCandidate_JobCandidateID'
END
GO
------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Shift; 
------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Work shift lookup table.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Work shift lookup table.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = default, @level2name = default
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Shift; COLUMN = ShiftID;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'COLUMN', N'ShiftID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Shift records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'ShiftID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Shift records.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'ShiftID'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Shift; COLUMN = Name;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Shift description.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Shift description.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Shift; COLUMN = StartTime;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'COLUMN', N'StartTime'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Shift start time.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'StartTime'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Shift start time.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'StartTime'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Shift; COLUMN = EndTime;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'COLUMN', N'EndTime'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Shift end time.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'EndTime'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Shift end time.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'EndTime'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:34 MS_Description for SCHEMA = HumanResources; TABLE = Shift; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = HumanResources; TABLE = Shift; INDEX = AK_Shift_Name;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'INDEX', N'AK_Shift_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'INDEX', @level2name = N'AK_Shift_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'INDEX', @level2name = N'AK_Shift_Name'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = HumanResources; TABLE = Shift; INDEX = AK_Shift_StartTime_EndTime;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'INDEX', N'AK_Shift_StartTime_EndTime'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'INDEX', @level2name = N'AK_Shift_StartTime_EndTime'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'INDEX', @level2name = N'AK_Shift_StartTime_EndTime'
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = HumanResources; TABLE = Shift; CONSTRAINT = PK_Shift_ShiftID;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'HumanResources', N'TABLE', N'Shift', N'CONSTRAINT', N'PK_Shift_ShiftID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'CONSTRAINT', @level2name = N'PK_Shift_ShiftID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'HumanResources', @level1type = N'TABLE', @level1name = N'Shift', @level2type = N'CONSTRAINT', @level2name = N'PK_Shift_ShiftID'
END
GO
------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; 
------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Street address information for customers, employees, and vendors.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Street address information for customers, employees, and vendors.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = AddressID;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'AddressID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Address records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'AddressID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Address records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'AddressID'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = AddressLine1;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'AddressLine1'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'First street address line.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'AddressLine1'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'First street address line.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'AddressLine1'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = AddressLine2;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'AddressLine2'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Second street address line.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'AddressLine2'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Second street address line.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'AddressLine2'
END
GO
--------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = City;
--------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'City'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Name of the city.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'City'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Name of the city.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'City'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = StateProvinceID;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'StateProvinceID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique identification number for the state or province. Foreign key to StateProvince table.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'StateProvinceID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique identification number for the state or province. Foreign key to StateProvince table.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'StateProvinceID'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = PostalCode;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'PostalCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Postal code for the street address.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'PostalCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Postal code for the street address.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'PostalCode'
END
GO
-----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = rowguid;
-----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; INDEX = AK_Address_rowguid;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'INDEX', N'AK_Address_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'INDEX', @level2name = N'AK_Address_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'INDEX', @level2name = N'AK_Address_rowguid'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; INDEX = IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode;
-----------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'INDEX', N'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'INDEX', @level2name = N'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'INDEX', @level2name = N'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; INDEX = IX_Address_StateProvinceID;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'INDEX', N'IX_Address_StateProvinceID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'INDEX', @level2name = N'IX_Address_StateProvinceID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'INDEX', @level2name = N'IX_Address_StateProvinceID'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Address; CONSTRAINT = PK_Address_AddressID;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Address', N'CONSTRAINT', N'PK_Address_AddressID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'CONSTRAINT', @level2name = N'PK_Address_AddressID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Address', @level2type = N'CONSTRAINT', @level2name = N'PK_Address_AddressID'
END
GO
----------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; 
----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Types of addresses stored in the Address table. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Types of addresses stored in the Address table. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; COLUMN = AddressTypeID;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'COLUMN', N'AddressTypeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for AddressType records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'AddressTypeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for AddressType records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'AddressTypeID'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; COLUMN = Name;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Address type description. For example, Billing, Home, or Shipping.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Address type description. For example, Billing, Home, or Shipping.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
---------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; COLUMN = rowguid;
---------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; INDEX = AK_AddressType_Name;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'INDEX', N'AK_AddressType_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'INDEX', @level2name = N'AK_AddressType_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'INDEX', @level2name = N'AK_AddressType_Name'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; INDEX = AK_AddressType_rowguid;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'INDEX', N'AK_AddressType_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'INDEX', @level2name = N'AK_AddressType_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'INDEX', @level2name = N'AK_AddressType_rowguid'
END
GO
----------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = AddressType; CONSTRAINT = PK_AddressType_AddressTypeID;
----------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'AddressType', N'CONSTRAINT', N'PK_AddressType_AddressTypeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'CONSTRAINT', @level2name = N'PK_AddressType_AddressTypeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'AddressType', @level2type = N'CONSTRAINT', @level2name = N'PK_AddressType_AddressTypeID'
END
GO
------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; 
------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Names of each employee, customer contact, and vendor contact.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Names of each employee, customer contact, and vendor contact.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = ContactID;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'ContactID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Contact records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'ContactID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Contact records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'ContactID'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = NameStyle;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'NameStyle'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = 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.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'NameStyle'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = 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.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'NameStyle'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = Title;
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'Title'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'A courtesy title. For example, Mr. or Ms.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'Title'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'A courtesy title. For example, Mr. or Ms.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'Title'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = FirstName;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'FirstName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'First name of the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'FirstName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'First name of the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'FirstName'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = MiddleName;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'MiddleName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Middle name or middle initial of the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'MiddleName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Middle name or middle initial of the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'MiddleName'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = LastName;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'LastName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Last name of the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'LastName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Last name of the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'LastName'
END
GO
----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = Suffix;
----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'Suffix'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Surname suffix. For example, Sr. or Jr.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'Suffix'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Surname suffix. For example, Sr. or Jr.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'Suffix'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = EmailAddress;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'EmailAddress'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'E-mail address for the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'EmailAddress'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'E-mail address for the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'EmailAddress'
END
GO
------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = EmailPromotion;
------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'EmailPromotion'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = 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. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'EmailPromotion'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = 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. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'EmailPromotion'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = Phone;
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'Phone'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Phone number associated with the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'Phone'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Phone number associated with the person.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'Phone'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = PasswordHash;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'PasswordHash'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Password for the e-mail account.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'PasswordHash'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Password for the e-mail account.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'PasswordHash'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = PasswordSalt;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'PasswordSalt'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Random value concatenated with the password string before the password is hashed.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'PasswordSalt'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Random value concatenated with the password string before the password is hashed.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'PasswordSalt'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = AdditionalContactInfo;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'AdditionalContactInfo'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Additional contact information about the person stored in xml format. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'AdditionalContactInfo'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Additional contact information about the person stored in xml format. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'AdditionalContactInfo'
END
GO
-----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = rowguid;
-----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; INDEX = AK_Contact_rowguid;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'INDEX', N'AK_Contact_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'INDEX', @level2name = N'AK_Contact_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'INDEX', @level2name = N'AK_Contact_rowguid'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; INDEX = IX_Contact_EmailAddress;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'INDEX', N'IX_Contact_EmailAddress'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'INDEX', @level2name = N'IX_Contact_EmailAddress'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'INDEX', @level2name = N'IX_Contact_EmailAddress'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; CONSTRAINT = PK_Contact_ContactID;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'CONSTRAINT', N'PK_Contact_ContactID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'CONSTRAINT', @level2name = N'PK_Contact_ContactID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'CONSTRAINT', @level2name = N'PK_Contact_ContactID'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = Contact; INDEX = PXML_Contact_AddContact;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'Contact', N'INDEX', N'PXML_Contact_AddContact'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary XML index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'INDEX', @level2name = N'PXML_Contact_AddContact'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary XML index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'Contact', @level2type = N'INDEX', @level2name = N'PXML_Contact_AddContact'
END
GO
----------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = ContactType; 
----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'ContactType', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the types of contacts stored in Contact.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the types of contacts stored in Contact.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = ContactType; COLUMN = ContactTypeID;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'ContactType', N'COLUMN', N'ContactTypeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ContactType records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'COLUMN', @level2name = N'ContactTypeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ContactType records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'COLUMN', @level2name = N'ContactTypeID'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = ContactType; COLUMN = Name;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'ContactType', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Contact type description.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Contact type description.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = ContactType; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'ContactType', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = ContactType; INDEX = AK_ContactType_Name;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'ContactType', N'INDEX', N'AK_ContactType_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'INDEX', @level2name = N'AK_ContactType_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'INDEX', @level2name = N'AK_ContactType_Name'
END
GO
----------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = ContactType; CONSTRAINT = PK_ContactType_ContactTypeID;
----------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'ContactType', N'CONSTRAINT', N'PK_ContactType_ContactTypeID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'CONSTRAINT', @level2name = N'PK_ContactType_ContactTypeID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'ContactType', @level2type = N'CONSTRAINT', @level2name = N'PK_ContactType_ContactTypeID'
END
GO
------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = CountryRegion; 
------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'CountryRegion', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the ISO standard codes for countries and regions.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the ISO standard codes for countries and regions.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = CountryRegion; COLUMN = CountryRegionCode;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'CountryRegion', N'COLUMN', N'CountryRegionCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ISO standard code for countries and regions.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'COLUMN', @level2name = N'CountryRegionCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ISO standard code for countries and regions.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'COLUMN', @level2name = N'CountryRegionCode'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = CountryRegion; COLUMN = Name;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'CountryRegion', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Country or region name.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Country or region name.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = CountryRegion; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'CountryRegion', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = CountryRegion; INDEX = AK_CountryRegion_Name;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'CountryRegion', N'INDEX', N'AK_CountryRegion_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'INDEX', @level2name = N'AK_CountryRegion_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'INDEX', @level2name = N'AK_CountryRegion_Name'
END
GO
------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = CountryRegion; CONSTRAINT = PK_CountryRegion_CountryRegionCode;
------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'CountryRegion', N'CONSTRAINT', N'PK_CountryRegion_CountryRegionCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'CONSTRAINT', @level2name = N'PK_CountryRegion_CountryRegionCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'CountryRegion', @level2type = N'CONSTRAINT', @level2name = N'PK_CountryRegion_CountryRegionCode'
END
GO
------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; 
------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'State and province lookup table.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'State and province lookup table.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = StateProvinceID;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'StateProvinceID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for StateProvince records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'StateProvinceID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for StateProvince records.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'StateProvinceID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = StateProvinceCode;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'StateProvinceCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ISO standard state or province code.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'StateProvinceCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ISO standard state or province code.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'StateProvinceCode'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = CountryRegionCode;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'CountryRegionCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'CountryRegionCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. ', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'CountryRegionCode'
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = IsOnlyStateProvinceFlag;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'IsOnlyStateProvinceFlag'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0 = StateProvinceCode exists. 1 = StateProvinceCode unavailable, using CountryRegionCode.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'IsOnlyStateProvinceFlag'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0 = StateProvinceCode exists. 1 = StateProvinceCode unavailable, using CountryRegionCode.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'IsOnlyStateProvinceFlag'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = Name;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'State or province description.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'State or province description.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = TerritoryID;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'TerritoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ID of the territory in which the state or province is located. Foreign key to SalesTerritory.SalesTerritoryID.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'TerritoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ID of the territory in which the state or province is located. Foreign key to SalesTerritory.SalesTerritoryID.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'TerritoryID'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = rowguid;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; INDEX = AK_StateProvince_Name;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'INDEX', N'AK_StateProvince_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'INDEX', @level2name = N'AK_StateProvince_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'INDEX', @level2name = N'AK_StateProvince_Name'
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; INDEX = AK_StateProvince_rowguid;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'INDEX', N'AK_StateProvince_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'INDEX', @level2name = N'AK_StateProvince_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'INDEX', @level2name = N'AK_StateProvince_rowguid'
END
GO
-------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; INDEX = AK_StateProvince_StateProvinceCode_CountryRegionCode;
-------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'INDEX', N'AK_StateProvince_StateProvinceCode_CountryRegionCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'INDEX', @level2name = N'AK_StateProvince_StateProvinceCode_CountryRegionCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'INDEX', @level2name = N'AK_StateProvince_StateProvinceCode_CountryRegionCode'
END
GO
----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Person; TABLE = StateProvince; CONSTRAINT = PK_StateProvince_StateProvinceID;
----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Person', N'TABLE', N'StateProvince', N'CONSTRAINT', N'PK_StateProvince_StateProvinceID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'CONSTRAINT', @level2name = N'PK_StateProvince_StateProvinceID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Person', @level1type = N'TABLE', @level1name = N'StateProvince', @level2type = N'CONSTRAINT', @level2name = N'PK_StateProvince_StateProvinceID'
END
GO
------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; 
------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = BillOfMaterialsID;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'BillOfMaterialsID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for BillOfMaterials records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'BillOfMaterialsID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for BillOfMaterials records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'BillOfMaterialsID'
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = ProductAssemblyID;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'ProductAssemblyID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Parent product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'ProductAssemblyID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Parent product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'ProductAssemblyID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = ComponentID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'ComponentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Component identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'ComponentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Component identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'ComponentID'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = StartDate;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the component started being used in the assembly item.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the component started being used in the assembly item.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'StartDate'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = EndDate;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'EndDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the component stopped being used in the assembly item.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'EndDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the component stopped being used in the assembly item.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'EndDate'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = UnitMeasureCode;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'UnitMeasureCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Standard code identifying the unit of measure for the quantity.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'UnitMeasureCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Standard code identifying the unit of measure for the quantity.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'UnitMeasureCode'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = BOMLevel;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'BOMLevel'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Indicates the depth the component is from its parent (AssemblyID).', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'BOMLevel'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Indicates the depth the component is from its parent (AssemblyID).', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'BOMLevel'
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = PerAssemblyQty;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'PerAssemblyQty'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Quantity of the component needed to create the assembly.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'PerAssemblyQty'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Quantity of the component needed to create the assembly.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'PerAssemblyQty'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; INDEX = AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate;
-------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'INDEX', N'AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Clustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'INDEX', @level2name = N'AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Clustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'INDEX', @level2name = N'AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; INDEX = IX_BillOfMaterials_UnitMeasureCode;
-------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'INDEX', N'IX_BillOfMaterials_UnitMeasureCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'INDEX', @level2name = N'IX_BillOfMaterials_UnitMeasureCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'INDEX', @level2name = N'IX_BillOfMaterials_UnitMeasureCode'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = BillOfMaterials; CONSTRAINT = PK_BillOfMaterials_BillOfMaterialsID;
--------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'BillOfMaterials', N'CONSTRAINT', N'PK_BillOfMaterials_BillOfMaterialsID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'CONSTRAINT', @level2name = N'PK_BillOfMaterials_BillOfMaterialsID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'BillOfMaterials', @level2type = N'CONSTRAINT', @level2name = N'PK_BillOfMaterials_BillOfMaterialsID'
END
GO
----------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Culture; 
----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Culture', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the languages in which some AdventureWorks data is stored.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Lookup table containing the languages in which some AdventureWorks data is stored.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = default, @level2name = default
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Culture; COLUMN = CultureID;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Culture', N'COLUMN', N'CultureID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Culture records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'COLUMN', @level2name = N'CultureID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Culture records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'COLUMN', @level2name = N'CultureID'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Culture; COLUMN = Name;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Culture', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Culture description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Culture description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Culture; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Culture', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Culture; INDEX = AK_Culture_Name;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Culture', N'INDEX', N'AK_Culture_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'INDEX', @level2name = N'AK_Culture_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'INDEX', @level2name = N'AK_Culture_Name'
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Culture; CONSTRAINT = PK_Culture_CultureID;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Culture', N'CONSTRAINT', N'PK_Culture_CultureID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'CONSTRAINT', @level2name = N'PK_Culture_CultureID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Culture', @level2type = N'CONSTRAINT', @level2name = N'PK_Culture_CultureID'
END
GO
-----------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; 
-----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product maintenance documents.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product maintenance documents.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = DocumentID;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'DocumentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Document records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'DocumentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Document records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'DocumentID'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = Title;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'Title'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Title of the document.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Title'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Title of the document.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Title'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = FileName;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'FileName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Directory path and file name of the document', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'FileName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Directory path and file name of the document', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'FileName'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = FileExtension;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'FileExtension'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'File extension indicating the document type. For example, .doc or .txt.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'FileExtension'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'File extension indicating the document type. For example, .doc or .txt.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'FileExtension'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = Revision;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'Revision'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Revision number of the document. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Revision'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Revision number of the document. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Revision'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = ChangeNumber;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'ChangeNumber'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Engineering change approval number.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'ChangeNumber'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Engineering change approval number.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'ChangeNumber'
END
GO
---------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = Status;
---------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'Status'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'1 = Pending approval, 2 = Approved, 3 = Obsolete', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Status'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'1 = Pending approval, 2 = Approved, 3 = Obsolete', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Status'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = DocumentSummary;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'DocumentSummary'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Document abstract.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'DocumentSummary'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Document abstract.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'DocumentSummary'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = Document;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'Document'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Complete document.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Document'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Complete document.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'Document'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; COLUMN = ModifiedDate;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; INDEX = AK_Document_FileName_Revision;
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'INDEX', N'AK_Document_FileName_Revision'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'INDEX', @level2name = N'AK_Document_FileName_Revision'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'INDEX', @level2name = N'AK_Document_FileName_Revision'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:35 MS_Description for SCHEMA = Production; TABLE = Document; CONSTRAINT = PK_Document_DocumentID;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Document', N'CONSTRAINT', N'PK_Document_DocumentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'CONSTRAINT', @level2name = N'PK_Document_DocumentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Document', @level2type = N'CONSTRAINT', @level2name = N'PK_Document_DocumentID'
END
GO
---------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Illustration; 
---------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Illustration', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Bicycle assembly diagrams.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Bicycle assembly diagrams.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Illustration; COLUMN = IllustrationID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Illustration', N'COLUMN', N'IllustrationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Illustration records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'COLUMN', @level2name = N'IllustrationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Illustration records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'COLUMN', @level2name = N'IllustrationID'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Illustration; COLUMN = Diagram;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Illustration', N'COLUMN', N'Diagram'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Illustrations used in manufacturing instructions. Stored as XML.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'COLUMN', @level2name = N'Diagram'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Illustrations used in manufacturing instructions. Stored as XML.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'COLUMN', @level2name = N'Diagram'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Illustration; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Illustration', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Illustration; CONSTRAINT = PK_Illustration_IllustrationID;
-----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Illustration', N'CONSTRAINT', N'PK_Illustration_IllustrationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'CONSTRAINT', @level2name = N'PK_Illustration_IllustrationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Illustration', @level2type = N'CONSTRAINT', @level2name = N'PK_Illustration_IllustrationID'
END
GO
-----------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; 
-----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product inventory and manufacturing locations.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product inventory and manufacturing locations.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; COLUMN = LocationID;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'COLUMN', N'LocationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Location records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'LocationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Location records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'LocationID'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; COLUMN = Name;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Location description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Location description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; COLUMN = CostRate;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'COLUMN', N'CostRate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Standard hourly cost of the manufacturing location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'CostRate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Standard hourly cost of the manufacturing location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'CostRate'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; COLUMN = Availability;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'COLUMN', N'Availability'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Work capacity (in hours) of the manufacturing location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'Availability'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Work capacity (in hours) of the manufacturing location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'Availability'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; COLUMN = ModifiedDate;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; INDEX = AK_Location_Name;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'INDEX', N'AK_Location_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'INDEX', @level2name = N'AK_Location_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'INDEX', @level2name = N'AK_Location_Name'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Location; CONSTRAINT = PK_Location_LocationID;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Location', N'CONSTRAINT', N'PK_Location_LocationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'CONSTRAINT', @level2name = N'PK_Location_LocationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Location', @level2type = N'CONSTRAINT', @level2name = N'PK_Location_LocationID'
END
GO
----------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; 
----------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Products sold or used in the manfacturing of sold products.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Products sold or used in the manfacturing of sold products.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = default, @level2name = default
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ProductID;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for Product records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for Product records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = Name;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Name of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Name of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ProductNumber;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ProductNumber'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique product identification number.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductNumber'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique product identification number.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductNumber'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = MakeFlag;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'MakeFlag'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0 = Product is purchased, 1 = Product is manufactured in-house.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'MakeFlag'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0 = Product is purchased, 1 = Product is manufactured in-house.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'MakeFlag'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = FinishedGoodsFlag;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'FinishedGoodsFlag'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0 = Product is not a salable item. 1 = Product is salable.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'FinishedGoodsFlag'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0 = Product is not a salable item. 1 = Product is salable.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'FinishedGoodsFlag'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = Color;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'Color'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product color.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Color'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product color.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Color'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = SafetyStockLevel;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'SafetyStockLevel'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Minimum inventory quantity. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SafetyStockLevel'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Minimum inventory quantity. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SafetyStockLevel'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ReorderPoint;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ReorderPoint'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Inventory level that triggers a purchase order or work order. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ReorderPoint'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Inventory level that triggers a purchase order or work order. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ReorderPoint'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = StandardCost;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'StandardCost'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Standard cost of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'StandardCost'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Standard cost of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'StandardCost'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ListPrice;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ListPrice'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Selling price.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ListPrice'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Selling price.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ListPrice'
END
GO
------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = Size;
------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'Size'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product size.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Size'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product size.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Size'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = SizeUnitMeasureCode;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'SizeUnitMeasureCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unit of measure for Size column.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SizeUnitMeasureCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unit of measure for Size column.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SizeUnitMeasureCode'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = WeightUnitMeasureCode;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'WeightUnitMeasureCode'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unit of measure for Weight column.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'WeightUnitMeasureCode'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unit of measure for Weight column.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'WeightUnitMeasureCode'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = Weight;
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'Weight'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product weight.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Weight'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product weight.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Weight'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = DaysToManufacture;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'DaysToManufacture'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Number of days required to manufacture the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'DaysToManufacture'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Number of days required to manufacture the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'DaysToManufacture'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ProductLine;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ProductLine'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'R = Road, M = Mountain, T = Touring, S = Standard', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductLine'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'R = Road, M = Mountain, T = Touring, S = Standard', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductLine'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = Class;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'Class'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'H = High, M = Medium, L = Low', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Class'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'H = High, M = Medium, L = Low', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Class'
END
GO
-------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = Style;
-------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'Style'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'W = Womens, M = Mens, U = Universal', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Style'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'W = Womens, M = Mens, U = Universal', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'Style'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ProductSubcategoryID;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ProductSubcategoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductSubcategoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductSubcategoryID'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ProductModelID;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ProductModelID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product is a member of this product model. Foreign key to ProductModel.ProductModelID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product is a member of this product model. Foreign key to ProductModel.ProductModelID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
GO
---------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = SellStartDate;
---------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'SellStartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the product was available for sale.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SellStartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the product was available for sale.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SellStartDate'
END
GO
-------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = SellEndDate;
-------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'SellEndDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the product was no longer available for sale.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SellEndDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the product was no longer available for sale.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'SellEndDate'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = DiscontinuedDate;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'DiscontinuedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date the product was discontinued.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'DiscontinuedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date the product was discontinued.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'DiscontinuedDate'
END
GO
---------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = rowguid;
---------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; INDEX = AK_Product_Name;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'INDEX', N'AK_Product_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'INDEX', @level2name = N'AK_Product_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'INDEX', @level2name = N'AK_Product_Name'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; INDEX = AK_Product_ProductNumber;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'INDEX', N'AK_Product_ProductNumber'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'INDEX', @level2name = N'AK_Product_ProductNumber'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'INDEX', @level2name = N'AK_Product_ProductNumber'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; INDEX = AK_Product_rowguid;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'INDEX', N'AK_Product_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'INDEX', @level2name = N'AK_Product_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'INDEX', @level2name = N'AK_Product_rowguid'
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = Product; CONSTRAINT = PK_Product_ProductID;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'Product', N'CONSTRAINT', N'PK_Product_ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'CONSTRAINT', @level2name = N'PK_Product_ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'Product', @level2type = N'CONSTRAINT', @level2name = N'PK_Product_ProductID'
END
GO
------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; 
------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'High-level product categorization.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'High-level product categorization.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; COLUMN = ProductCategoryID;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'COLUMN', N'ProductCategoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductCategory records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'ProductCategoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductCategory records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'ProductCategoryID'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; COLUMN = Name;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Category description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Category description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; COLUMN = rowguid;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; INDEX = AK_ProductCategory_Name;
--------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'INDEX', N'AK_ProductCategory_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'INDEX', @level2name = N'AK_ProductCategory_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'INDEX', @level2name = N'AK_ProductCategory_Name'
END
GO
-----------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; INDEX = AK_ProductCategory_rowguid;
-----------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'INDEX', N'AK_ProductCategory_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'INDEX', @level2name = N'AK_ProductCategory_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'INDEX', @level2name = N'AK_ProductCategory_rowguid'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCategory; CONSTRAINT = PK_ProductCategory_ProductCategoryID;
--------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCategory', N'CONSTRAINT', N'PK_ProductCategory_ProductCategoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductCategory_ProductCategoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCategory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductCategory_ProductCategoryID'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; 
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Changes in the cost of a product over time.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Changes in the cost of a product over time.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = default, @level2name = default
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; COLUMN = ProductID;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; COLUMN = StartDate;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', N'COLUMN', N'StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product cost start date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product cost start date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'StartDate'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; COLUMN = EndDate;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', N'COLUMN', N'EndDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product cost end date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'EndDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product cost end date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'EndDate'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; COLUMN = StandardCost;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', N'COLUMN', N'StandardCost'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Standard cost of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'StandardCost'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Standard cost of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'StandardCost'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
----------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductCostHistory; CONSTRAINT = PK_ProductCostHistory_ProductID_StartDate;
----------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductCostHistory', N'CONSTRAINT', N'PK_ProductCostHistory_ProductID_StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductCostHistory_ProductID_StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductCostHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductCostHistory_ProductID_StartDate'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; 
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product descriptions in several languages.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product descriptions in several languages.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; COLUMN = ProductDescriptionID;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', N'COLUMN', N'ProductDescriptionID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductDescription records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'ProductDescriptionID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductDescription records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'ProductDescriptionID'
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; COLUMN = Description;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', N'COLUMN', N'Description'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Description of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'Description'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Description of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'Description'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; COLUMN = rowguid;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; INDEX = AK_ProductDescription_rowguid;
-----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', N'INDEX', N'AK_ProductDescription_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'INDEX', @level2name = N'AK_ProductDescription_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'INDEX', @level2name = N'AK_ProductDescription_rowguid'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDescription; CONSTRAINT = PK_ProductDescription_ProductDescriptionID;
-----------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDescription', N'CONSTRAINT', N'PK_ProductDescription_ProductDescriptionID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductDescription_ProductDescriptionID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDescription', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductDescription_ProductDescriptionID'
END
GO
------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDocument; 
------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDocument', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping products to related product documents.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping products to related product documents.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDocument; COLUMN = ProductID;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDocument', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDocument; COLUMN = DocumentID;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDocument', N'COLUMN', N'DocumentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Document identification number. Foreign key to Document.DocumentID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'COLUMN', @level2name = N'DocumentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Document identification number. Foreign key to Document.DocumentID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'COLUMN', @level2name = N'DocumentID'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDocument; COLUMN = ModifiedDate;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDocument', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductDocument; CONSTRAINT = PK_ProductDocument_ProductID_DocumentID;
-----------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductDocument', N'CONSTRAINT', N'PK_ProductDocument_ProductID_DocumentID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductDocument_ProductID_DocumentID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductDocument', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductDocument_ProductID_DocumentID'
END
GO
-------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; 
-------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product inventory information.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product inventory information.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = default, @level2name = default
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = ProductID;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = LocationID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'LocationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Inventory location identification number. Foreign key to Location.LocationID. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'LocationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Inventory location identification number. Foreign key to Location.LocationID. ', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'LocationID'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = Shelf;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'Shelf'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Storage compartment within an inventory location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'Shelf'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Storage compartment within an inventory location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'Shelf'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = Bin;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'Bin'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Storage container on a shelf in an inventory location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'Bin'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Storage container on a shelf in an inventory location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'Bin'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = Quantity;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'Quantity'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Quantity of products in the inventory location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'Quantity'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Quantity of products in the inventory location.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'Quantity'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = rowguid;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; COLUMN = ModifiedDate;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductInventory; CONSTRAINT = PK_ProductInventory_ProductID_LocationID;
-------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductInventory', N'CONSTRAINT', N'PK_ProductInventory_ProductID_LocationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductInventory_ProductID_LocationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductInventory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductInventory_ProductID_LocationID'
END
GO
--------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; 
--------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Changes in the list price of a product over time.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Changes in the list price of a product over time.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; COLUMN = ProductID;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; COLUMN = StartDate;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', N'COLUMN', N'StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'List price start date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'List price start date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'StartDate'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; COLUMN = EndDate;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', N'COLUMN', N'EndDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'List price end date', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'EndDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'List price end date', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'EndDate'
END
GO
---------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; COLUMN = ListPrice;
---------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', N'COLUMN', N'ListPrice'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product list price.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'ListPrice'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product list price.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'ListPrice'
END
GO
------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; COLUMN = ModifiedDate;
------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductListPriceHistory; CONSTRAINT = PK_ProductListPriceHistory_ProductID_StartDate;
--------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductListPriceHistory', N'CONSTRAINT', N'PK_ProductListPriceHistory_ProductID_StartDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductListPriceHistory_ProductID_StartDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductListPriceHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductListPriceHistory_ProductID_StartDate'
END
GO
---------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; 
---------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product model classification.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product model classification.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; COLUMN = ProductModelID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'COLUMN', N'ProductModelID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductModel records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductModel records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
GO
-----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; COLUMN = Name;
-----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product model description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product model description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; COLUMN = CatalogDescription;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'COLUMN', N'CatalogDescription'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Detailed product catalog information in xml format.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'CatalogDescription'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Detailed product catalog information in xml format.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'CatalogDescription'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; COLUMN = Instructions;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'COLUMN', N'Instructions'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Manufacturing instructions in xml format.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'Instructions'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Manufacturing instructions in xml format.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'Instructions'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; COLUMN = rowguid;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; INDEX = AK_ProductModel_Name;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'INDEX', N'AK_ProductModel_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'AK_ProductModel_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'AK_ProductModel_Name'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; INDEX = AK_ProductModel_rowguid;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'INDEX', N'AK_ProductModel_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'AK_ProductModel_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'AK_ProductModel_rowguid'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; CONSTRAINT = PK_ProductModel_ProductModelID;
-----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'CONSTRAINT', N'PK_ProductModel_ProductModelID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductModel_ProductModelID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductModel_ProductModelID'
END
GO
------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; INDEX = PXML_ProductModel_CatalogDescription;
------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'INDEX', N'PXML_ProductModel_CatalogDescription'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary XML index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'PXML_ProductModel_CatalogDescription'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary XML index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'PXML_ProductModel_CatalogDescription'
END
GO
------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModel; INDEX = PXML_ProductModel_Instructions;
------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModel', N'INDEX', N'PXML_ProductModel_Instructions'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary XML index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'PXML_ProductModel_Instructions'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary XML index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModel', @level2type = N'INDEX', @level2name = N'PXML_ProductModel_Instructions'
END
GO
---------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModelIllustration; 
---------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelIllustration', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping product models and illustrations.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping product models and illustrations.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModelIllustration; COLUMN = ProductModelID;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelIllustration', N'COLUMN', N'ProductModelID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to ProductModel.ProductModelID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to ProductModel.ProductModelID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModelIllustration; COLUMN = IllustrationID;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelIllustration', N'COLUMN', N'IllustrationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to Illustration.IllustrationID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'COLUMN', @level2name = N'IllustrationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to Illustration.IllustrationID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'COLUMN', @level2name = N'IllustrationID'
END
GO
-------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModelIllustration; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelIllustration', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:36 MS_Description for SCHEMA = Production; TABLE = ProductModelIllustration; CONSTRAINT = PK_ProductModelIllustration_ProductModelID_IllustrationID;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelIllustration', N'CONSTRAINT', N'PK_ProductModelIllustration_ProductModelID_IllustrationID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductModelIllustration_ProductModelID_IllustrationID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelIllustration', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductModelIllustration_ProductModelID_IllustrationID'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductModelProductDescriptionCulture; 
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelProductDescriptionCulture', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping product descriptions and the language the description is written in.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping product descriptions and the language the description is written in.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = default, @level2name = default
END
GO
----------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductModelProductDescriptionCulture; COLUMN = ProductModelID;
----------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelProductDescriptionCulture', N'COLUMN', N'ProductModelID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to ProductModel.ProductModelID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to ProductModel.ProductModelID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'ProductModelID'
END
GO
----------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductModelProductDescriptionCulture; COLUMN = ProductDescriptionID;
----------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelProductDescriptionCulture', N'COLUMN', N'ProductDescriptionID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to ProductDescription.ProductDescriptionID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'ProductDescriptionID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key. Foreign key to ProductDescription.ProductDescriptionID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'ProductDescriptionID'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductModelProductDescriptionCulture; COLUMN = CultureID;
-----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelProductDescriptionCulture', N'COLUMN', N'CultureID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Culture identification number. Foreign key to Culture.CultureID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'CultureID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Culture identification number. Foreign key to Culture.CultureID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'CultureID'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductModelProductDescriptionCulture; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelProductDescriptionCulture', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductModelProductDescriptionCulture; CONSTRAINT = PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductModelProductDescriptionCulture', N'CONSTRAINT', N'PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductModelProductDescriptionCulture', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID'
END
GO
---------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; 
---------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product images.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product images.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; COLUMN = ProductPhotoID;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'COLUMN', N'ProductPhotoID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductPhoto records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ProductPhotoID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductPhoto records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ProductPhotoID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; COLUMN = ThumbNailPhoto;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'COLUMN', N'ThumbNailPhoto'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Small image of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ThumbNailPhoto'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Small image of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ThumbNailPhoto'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; COLUMN = ThumbnailPhotoFileName;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'COLUMN', N'ThumbnailPhotoFileName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Small image file name.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ThumbnailPhotoFileName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Small image file name.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ThumbnailPhotoFileName'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; COLUMN = LargePhoto;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'COLUMN', N'LargePhoto'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Large image of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'LargePhoto'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Large image of the product.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'LargePhoto'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; COLUMN = LargePhotoFileName;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'COLUMN', N'LargePhotoFileName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Large image file name.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'LargePhotoFileName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Large image file name.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'LargePhotoFileName'
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductPhoto; CONSTRAINT = PK_ProductPhoto_ProductPhotoID;
-----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductPhoto', N'CONSTRAINT', N'PK_ProductPhoto_ProductPhotoID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductPhoto_ProductPhotoID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductPhoto', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductPhoto_ProductPhotoID'
END
GO
----------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductProductPhoto; 
----------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductProductPhoto', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping products and product photos.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping products and product photos.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = default, @level2name = default
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductProductPhoto; COLUMN = ProductID;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductProductPhoto', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductProductPhoto; COLUMN = ProductPhotoID;
----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductProductPhoto', N'COLUMN', N'ProductPhotoID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'ProductPhotoID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'ProductPhotoID'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductProductPhoto; COLUMN = Primary;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductProductPhoto', N'COLUMN', N'Primary'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0 = Photo is not the principal image. 1 = Photo is the principal image.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'Primary'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0 = Photo is not the principal image. 1 = Photo is the principal image.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'Primary'
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductProductPhoto; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductProductPhoto', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductProductPhoto; CONSTRAINT = PK_ProductProductPhoto_ProductID_ProductPhotoID;
-----------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductProductPhoto', N'CONSTRAINT', N'PK_ProductProductPhoto_ProductID_ProductPhotoID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductProductPhoto_ProductID_ProductPhotoID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductProductPhoto', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductProductPhoto_ProductID_ProductPhotoID'
END
GO
----------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; 
----------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Customer reviews of products they have purchased.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Customer reviews of products they have purchased.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = default, @level2name = default
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = ProductReviewID;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'ProductReviewID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductReview records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ProductReviewID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductReview records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ProductReviewID'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = ProductID;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = ReviewerName;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'ReviewerName'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Name of the reviewer.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ReviewerName'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Name of the reviewer.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ReviewerName'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = ReviewDate;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'ReviewDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date review was submitted.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ReviewDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date review was submitted.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ReviewDate'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = EmailAddress;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'EmailAddress'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Reviewer's e-mail address.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'EmailAddress'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Reviewer's e-mail address.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'EmailAddress'
END
GO
--------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = Rating;
--------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'Rating'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'Rating'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'Rating'
END
GO
----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = Comments;
----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'Comments'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Reviewer's comments', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'Comments'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Reviewer's comments', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'Comments'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; COLUMN = ModifiedDate;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; INDEX = IX_ProductReview_ProductID_Name;
--------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'INDEX', N'IX_ProductReview_ProductID_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'INDEX', @level2name = N'IX_ProductReview_ProductID_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'INDEX', @level2name = N'IX_ProductReview_ProductID_Name'
END
GO
--------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductReview; CONSTRAINT = PK_ProductReview_ProductReviewID;
--------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductReview', N'CONSTRAINT', N'PK_ProductReview_ProductReviewID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductReview_ProductReviewID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductReview', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductReview_ProductReviewID'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; 
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product subcategories. See ProductCategory table.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product subcategories. See ProductCategory table.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = default, @level2name = default
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; COLUMN = ProductSubcategoryID;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'COLUMN', N'ProductSubcategoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductSubcategory records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'ProductSubcategoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ProductSubcategory records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'ProductSubcategoryID'
END
GO
------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; COLUMN = ProductCategoryID;
------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'COLUMN', N'ProductCategoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product category identification number. Foreign key to ProductCategory.ProductCategoryID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'ProductCategoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product category identification number. Foreign key to ProductCategory.ProductCategoryID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'ProductCategoryID'
END
GO
-----------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; COLUMN = Name;
-----------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Subcategory description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Subcategory description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
--------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; COLUMN = rowguid;
--------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'COLUMN', N'rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'rowguid'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
--------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; INDEX = AK_ProductSubcategory_Name;
--------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'INDEX', N'AK_ProductSubcategory_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'INDEX', @level2name = N'AK_ProductSubcategory_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'INDEX', @level2name = N'AK_ProductSubcategory_Name'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; INDEX = AK_ProductSubcategory_rowguid;
-----------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'INDEX', N'AK_ProductSubcategory_rowguid'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'INDEX', @level2name = N'AK_ProductSubcategory_rowguid'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index. Used to support replication samples.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'INDEX', @level2name = N'AK_ProductSubcategory_rowguid'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ProductSubcategory; CONSTRAINT = PK_ProductSubcategory_ProductSubcategoryID;
-----------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ProductSubcategory', N'CONSTRAINT', N'PK_ProductSubcategory_ProductSubcategoryID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductSubcategory_ProductSubcategoryID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ProductSubcategory', @level2type = N'CONSTRAINT', @level2name = N'PK_ProductSubcategory_ProductSubcategoryID'
END
GO
--------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ScrapReason; 
--------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ScrapReason', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Manufacturing failure reasons lookup table.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Manufacturing failure reasons lookup table.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = default, @level2name = default
END
GO
-------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ScrapReason; COLUMN = ScrapReasonID;
-------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ScrapReason', N'COLUMN', N'ScrapReasonID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for ScrapReason records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'COLUMN', @level2name = N'ScrapReasonID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for ScrapReason records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'COLUMN', @level2name = N'ScrapReasonID'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ScrapReason; COLUMN = Name;
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ScrapReason', N'COLUMN', N'Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Failure description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'COLUMN', @level2name = N'Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Failure description.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'COLUMN', @level2name = N'Name'
END
GO
------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ScrapReason; COLUMN = ModifiedDate;
------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ScrapReason', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ScrapReason; INDEX = AK_ScrapReason_Name;
------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ScrapReason', N'INDEX', N'AK_ScrapReason_Name'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'INDEX', @level2name = N'AK_ScrapReason_Name'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Unique nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'INDEX', @level2name = N'AK_ScrapReason_Name'
END
GO
--------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = ScrapReason; CONSTRAINT = PK_ScrapReason_ScrapReasonID;
--------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'ScrapReason', N'CONSTRAINT', N'PK_ScrapReason_ScrapReasonID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'CONSTRAINT', @level2name = N'PK_ScrapReason_ScrapReasonID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'ScrapReason', @level2type = N'CONSTRAINT', @level2name = N'PK_ScrapReason_ScrapReasonID'
END
GO
---------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; 
---------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', default, default))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Record of each purchase order, sales order, or work order transaction year to date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = default, @level2name = default
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Record of each purchase order, sales order, or work order transaction year to date.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = default, @level2name = default
END
GO
--------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = TransactionID;
--------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'TransactionID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key for TransactionHistory records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'TransactionID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key for TransactionHistory records.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'TransactionID'
END
GO
----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = ProductID;
----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product identification number. Foreign key to Product.ProductID.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ProductID'
END
GO
-----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = ReferenceOrderID;
-----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'ReferenceOrderID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Purchase order, sales order, or work order identification number.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ReferenceOrderID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Purchase order, sales order, or work order identification number.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ReferenceOrderID'
END
GO
---------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = ReferenceOrderLineID;
---------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'ReferenceOrderLineID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Line number associated with the purchase order, sales order, or work order.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ReferenceOrderLineID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Line number associated with the purchase order, sales order, or work order.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ReferenceOrderLineID'
END
GO
----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = TransactionDate;
----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'TransactionDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time of the transaction.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'TransactionDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time of the transaction.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'TransactionDate'
END
GO
----------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = TransactionType;
----------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'TransactionType'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'W = WorkOrder, S = SalesOrder, P = PurchaseOrder', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'TransactionType'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'W = WorkOrder, S = SalesOrder, P = PurchaseOrder', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'TransactionType'
END
GO
---------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = Quantity;
---------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'Quantity'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product quantity.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'Quantity'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product quantity.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'Quantity'
END
GO
-----------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = ActualCost;
-----------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'ActualCost'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Product cost.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ActualCost'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Product cost.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ActualCost'
END
GO
-------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; COLUMN = ModifiedDate;
-------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'COLUMN', N'ModifiedDate'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'COLUMN', @level2name = N'ModifiedDate'
END
GO
-------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; INDEX = IX_TransactionHistory_ProductID;
-------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'INDEX', N'IX_TransactionHistory_ProductID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'INDEX', @level2name = N'IX_TransactionHistory_ProductID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'INDEX', @level2name = N'IX_TransactionHistory_ProductID'
END
GO
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; INDEX = IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'INDEX', N'IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'INDEX', @level2name = N'IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'INDEX', @level2name = N'IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID'
END
GO
----------------------------------------------------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistory; CONSTRAINT = PK_TransactionHistory_TransactionID;
----------------------------------------------------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistory', N'CONSTRAINT', N'PK_TransactionHistory_TransactionID'))
BEGIN
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_TransactionHistory_TransactionID'
END
ELSE
BEGIN
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Production', @level1type = N'TABLE', @level1name = N'TransactionHistory', @level2type = N'CONSTRAINT', @level2name = N'PK_TransactionHistory_TransactionID'
END
GO
----------------------------------------------------------------------------------------------------
-- 12.12.2011 22:03:37 MS_Description for SCHEMA = Production; TABLE = TransactionHistoryArchive; 
----------------------------------------------------------------------------------------------------
IF EXISTS(SELECT * FROM fn_listextendedproperty(N'MS_Description', N'SCHEMA', N'Production', N'TABLE', N'TransactionHistoryArchive', default, default))
