{"text_format":"1","workbook":"xlsx","n_sheets":12,"sheets":["Home","1_SaleModel","ReadMe","Change Log","DimCustomer","DimDate","DimProduct","DimEmployee","FactSales","Blank Dimension","Blank Fact","Sheet1"],"not_rendered":{"charts":0,"images":1,"macros":1,"external_links":0,"defined_names":7,"comments":8,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"Home","index":0,"n_rows":28,"n_cols":3,"rows_kept":28,"cut":false,"hidden":false,"merged":[]}
[null,"The Microsoft Data Warehouse Toolkit 2008 R2"]
[null,"Dimensional Modeling Workbook"]
[]
[null,"Date:","2011-02-18"]
[null,"Database:"]
[null,"Description:","The Northwind Traders Datawarehouse"]
[null,"Version:",4]
[null,"Gen FKs?:","Y"]
[null,"Schema for Views:","northwind"]
[]
[null,null,"How to use this tool:"]
[null,null,"1) Copy the BlankDim and BlankFact worksheets and fill them in with appropriate dimension and fact table information"]
[null,null,"2) Change the database name above to the name of the target database to which you would like to write this dimensional model"]
[null,null,"3) Make sure macros are enabled, and select the Create/Update Diagram(s) button to see a simple bubble diagram of your model"]
[null,null,"4) Select the Generate SQL Script button to generate a script you can use to create your database"]
[null,null,"     (This is the \"forward engineer\" button.)"]
[null,null,"5) See the ReadMe sheet for additional information"]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[null,"© copyright 2005-2011, Kimball Group, all rights reserved"]

{"sheet":"1_SaleModel","index":1,"n_rows":0,"n_cols":0,"rows_kept":0,"cut":false,"hidden":false,"merged":[]}

{"sheet":"ReadMe","index":2,"n_rows":0,"n_cols":0,"rows_kept":0,"cut":false,"hidden":false,"merged":[]}

{"sheet":"Change Log","index":3,"n_rows":17,"n_cols":5,"rows_kept":17,"cut":false,"hidden":false,"merged":[]}
["Date","Change #","Version #","Person","Description"]
["2011-02-07",16,4,"JM","Confirmed for SQL2008R2. Fixed many small bugs, including FK generation. Added user-oriented views that use the display names. Made it prettier."]
["2009-02-16",15,3.4,"JM","Changed char and varchar datatypes to nchar / nvarchar almost everywhere. Added a few transaction IDs that are useful in the ETL process."]
["2009-01-15",14,3.4,"JM","Translated to Excel 2007. Translated to SQL 2008. Changed database recovery mode to simple. Simplified audit dimension."]
["2008-06-11",13,3.3,"WT","Added a macro to convert version 3.2 worksheets into version 3.3"]
["2008-05-20",12,3.3,"WT","Added the ability to specify an optional schema level in the table names and removed spurious references to the word schema."]
["2008-04-04",11,3.2,"WT","Updated bubble diagram generator to include fact table column name in all role playing dims"]
["2007-11-16",10,3.2,"WT","Removed the SET IDENTITY INSERT commands for tables that do not have an IDENTITY column"]
["2006-08-10",9,null,"WT","Added code to allow the Audit dimension to be identified as an Audit Table Type rather than a dimension."]
["2006-08-07",8,null,"WT","Updated the instructions"]
["2006-07-25",7,null,"WT","Added a Description for the overall database on the Schemas page and set the macro to overwrite the extended property if the Description already exists."]
["2006-07-25",6,null,"WT","Added a Display Name field at the attribute level"]
["2006-07-13",5,null,"WT","Added the bubble diagram generator"]
["2006-05-18",4,null,"JM","Oops. Fixed parentheses error that showed up (for whatever reason) in non-US locales."]
["2006-01-11",3,null,"JM","Fixed FK generation error"]
["2005-08-30",2,null,"WT","Removed Region Alternate Hierarchy, added Sales Region to Customer"]
["2005-08-30",1,null,"WT","Added Change Log tab"]

{"sheet":"DimCustomer","index":4,"n_rows":25,"n_cols":21,"rows_kept":25,"cut":false,"hidden":false,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","DimCustomer"]
["Table Type","Dimension"]
["Display Name","Customer"]
["Database Schema","northwind"]
["Table Description","Customers dimension"]
["Comment","comes from customers table in northwind"]
["Biz Filter Logic"]
["Size","one for each customer"]
["Generate Script?","Y"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["CustomerKey","CustomerKey","Surrogate primary key",-1,"1, 2, 3…","key",null,null,null,"int",null,null,"PK ID",null,"N",null,"Derived"]
["CustomerID","CustomerID","Business key from source system (aka natural key)","NONE","ALFKI","key",null,null,null,"nvarchar",5,null,null,null,"N",null,"Northwind","dbo","Customers","CustomerID","nvarchar"]
["CompanyName","CompanyName","Customer's company Name","No Customer","Bon app'",2,null,null,null,"nvarchar",40,null,null,null,"N",null,"Northwind","dbo","Customers","CompanyName","nvarchar"]
["ContactName","ContactName","Name of contact at the company","None","Pedro Alfanso",2,null,null,null,"nvarchar",30,null,null,null,"N",null,"Northwind","dbo","Customers","ContactName","nvarchar"]
["ContactTitle","ContactTitle","Contact's job title","None","Owner, Sales Rep.",2,null,null,null,"nvarchar",30,null,null,null,"N",null,"Northwind","dbo","Customers","ContactTitle","nvarchar"]
["CustomerCountry","CustomerCountry","Country of origin ","None","USA",2,null,null,null,"nvarchar",15,null,null,null,"N",null,"Northwind","dbo","Customers","Country","nvarchar"]
["CustomerRegion","CustomerRegion","State or province","None","WA",2,null,null,null,"nvarchar",15,null,null,null,"N","N/A","Northwind","dbo","Customers","Region","nvarchar"]
["CustomerCity","CustomerCity","Customer's City","None","Seattle",2,null,null,null,"nvarchar",15,null,null,null,"N",null,"Northwind","dbo","Customers","City","nvarchar"]
["CustomerPostalCode","CustomerPostalCode","Customer's postal code","None",13244,2,null,null,null,"nvarchar",10,null,null,null,"N",null,"Northwind","dbo","Customers","PostalCode","nvarchar"]
["RowIsCurrent","Row Is Current","Is this the current row for this member (Y/N)?",1,"TRUE, FALSE","n/a","Exclude from cube","Standard SCD-2",null,"bit",null,null,null,null,"N",1,"Derived"]
["RowStartDate","Row Start Date","When did this row become valid for this member?","1900-01-01","2011-01-24","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","1900-01-01","Derived"]
["RowEndDate","Row End Date","When did this row become invalid? (12/31/9999 if current row)","9999-12-31","1/14/1998, 12/31/9999","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","9999-12-31","Derived"]
["RowChangeReason","Row Change Reason","Why did the row change last?","N/A",null,"n/a","Exclude from cube","Standard SCD-2",null,"nvarchar",200,null,null,null,"Y",null,"Derived"]

{"sheet":"DimDate","index":5,"n_rows":26,"n_cols":21,"rows_kept":26,"cut":false,"hidden":false,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","DimDate"]
["Table Type","Dimension"]
["Display Name","Date"]
["Database Schema","northwind"]
["Table Description","Date dimension contains one row for every day, beginning at 1/1/2005. There may also be rows for \"hasn't happened yet.\""]
["Comment","The Date dimension is derived; it is not populated from any transaction system.  "]
["Biz Filter Logic"]
["Size","365/year"]
["Generate Script?","Y"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["DateKey","DateKey","Surrogate primary key",-1,20041123,null,null,"In the form: yyyymmdd",null,"int",null,null,"PK",null,"N",null,"Derived"]
["Date","Date","Full date as a SQL date",null,38314,null,"Day",null,null,"date",null,null,null,null,"Y",null,"Derived"]
["FullDateUSA","FullDateUSA","String expression of the full date, eg MM/DD/YYYY","Unk date","23-Nov-2004",1,"Day",null,null,"nchar",11,null,null,null,"N",null,"Derived"]
["DayOfWeek","DayOfWeek","Number of the day of week; Sunday = 1",0,"1..7",1,"Day",null,null,"tinyint",null,null,null,null,"N",null,"Derived"]
["DayName","DayName","Day name of week, eg Monday","Unk date","Sunday",1,"Day",null,null,"nchar",10,null,null,null,"N",null,"Derived"]
["DayOfMonth","DayOfMonth","Number of the day in the month",0,"1..31",1,"Day",null,null,"tinyint",null,null,null,null,"N",null,"Derived"]
["DayOfYear","DayOfYear","Number of the day in the year",0,"1..365",1,"Day",null,null,"smallint",null,null,null,null,"N",null,"Derived"]
["WeekOfYear","WeekOfYear","Week of year, 1..53",0,"1..52 or 53",1,"Calendar",null,null,"tinyint",null,null,null,null,"N",null,"Derived"]
["MonthName","MonthName","Month name, eg January","Unk month","November",1,"Calendar",null,null,"nchar",10,null,null,null,"N",null,"Derived"]
["MonthOfYear","MonthOfYear","Month of year, 1..12",0,"1, 2, …, 12",1,"Calendar",null,null,"tinyint",null,null,null,null,"N",null,"Derived"]
["Quarter","Quarter","Calendar quarter, 1..4",0,"1, 2, 3, 4",1,"Calendar",null,null,"tinyint",null,null,null,null,"N",null,"Derived"]
["QuarterName","QuarterName","Quarter name eg. First","Unk qtr","November",1,"Calendar",null,null,"nchar",10,null,null,null,"N",null,"Derived"]
["Year","Year","Calendar year, eg 2010",0,2004,1,"Calendar",null,null,"smallint",null,null,null,null,"N",null,"Derived"]
["IsWeekday","IsWeekday","Is today a weekday",0,"1, 0",1,"Day",null,null,"bit",null,null,null,null,"N",0,"Derived"]

{"sheet":"DimProduct","index":6,"n_rows":22,"n_cols":21,"rows_kept":22,"cut":false,"hidden":false,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","DimProduct"]
["Table Type","Dimension"]
["Display Name","Product"]
["Database Schema","northwind"]
["Table Description","Products on an order (with supplier and category info)"]
["Comment","rollup into suppliers and categories"]
["Biz Filter Logic"]
["Size"]
["Generate Script?","Y"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["ProductKey","ProductKey","Surrogate primary key",-1,"1, 2, 3…","key",null,null,null,"int",null,null,"PK ID",null,"N",null,"Derived"]
["ProductID","ProductID","Business key from source system (aka natural key)",-1,"1,2,3,…","key",null,null,null,"int",null,null,null,null,"N",null,"Northwind","dbo","Products","ProductID","int"]
["ProductName","ProductName","Name of product","None","Chi Tea",2,null,null,null,"nvarchar",40,null,null,null,"N",null,"Northwind","dbo","Products","ProductName","varchar"]
["Discontinued","Discontinued","Is the product discontinued?","?",false,2,null,null,null,"nchar",1,null,null,null,"N","N","Northwind","dbo","Products","Discontinued","bit"]
["SupplierName","SupplierName","Name of supplier for product","None","Bigfoot Breweries",2,null,null,null,"nvarchar",40,null,null,null,"N",null,"Northwind","dbo","Suppliers","SupplierName","varchar"]
["CategoryName","CategoryName","Product's category","None","Seafood",2,null,null,null,"nvarchar",15,null,null,null,"N",null,"Northwind","dbo","Categories","CategoryName","varchar"]
["RowIsCurrent","Row Is Current","Is this the current row for this member (Y/N)?",1,"TRUE, FALSE","n/a","Exclude from cube","Standard SCD-2",null,"bit",null,null,null,null,"N",1,"Derived"]
["RowStartDate","Row Start Date","When did this row become valid for this member?","1900-01-01","2011-01-24","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","1900-01-01","Derived"]
["RowEndDate","Row End Date","When did this row become invalid? (12/31/9999 if current row)","9999-12-31","1/14/1998, 12/31/9999","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","9999-12-31","Derived"]
["RowChangeReason","Row Change Reason","Why did the row change last?","N/A",null,"n/a","Exclude from cube","Standard SCD-2",null,"nvarchar",200,null,null,null,"Y",null,"Derived"]

{"sheet":"DimEmployee","index":7,"n_rows":20,"n_cols":21,"rows_kept":20,"cut":false,"hidden":false,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","DimEmployee"]
["Table Type","Dimension"]
["Display Name","Employee"]
["Database Schema","northwind"]
["Table Description","Employee table"]
["Comment"]
["Biz Filter Logic"]
["Size"]
["Generate Script?","Y"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["EmployeeKey","EmployeeKey","Surrogate primary key",-1,"1, 2, 3…","key",null,null,null,"int",null,null,"PK ID",null,"N",null,"Derived"]
["EmployeeID","EmployeeID","Business key from source system (aka natural key)",-1,null,"key",null,null,null,"int",null,null,null,null,"N",null,"Northwind","dbo","Employees","EmployeeID","int"]
["EmployeeName","EmployeeName","Employee's Name","None",null,1,null,null,null,"nvarchar",40,null,null,null,"N",null,"Northwind","dbo","Employees","EmployeeName","varchar"]
["EmployeeTitle","EmployeeTitle","Employee's Job Title","None",null,2,null,null,null,"nvarchar",30,null,null,null,"N",null,"Northwind","dbo","Employees","EmployeeTitle","varchar"]
["RowIsCurrent","Row Is Current","Is this the current row for this member (Y/N)?",1,"TRUE, FALSE","n/a","Exclude from cube","Standard SCD-2",null,"bit ",null,null,null,null,"N",1,"Derived"]
["RowStartDate","Row Start Date","When did this row become valid for this member?","1900-01-01","2011-01-24","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","1900-01-01","Derived"]
["RowEndDate","Row End Date","When did this row become invalid? (12/31/9999 if current row)","9999-12-31","1/14/1998, 12/31/9999","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","9999-12-31","Derived"]
["RowChangeReason","Row Change Reason","Why did the row change last?","N/A",null,"n/a","Exclude from cube","Standard SCD-2",null,"nvarchar",200,null,null,null,"Y",null,"Derived"]

{"sheet":"FactSales","index":8,"n_rows":24,"n_cols":21,"rows_kept":24,"cut":false,"hidden":false,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","FactSales"]
["Table Type","Fact"]
["Display Name","Sales"]
["Database Schema","northwind"]
["Table Description","Sales order information"]
["Comment"]
["Biz Filter Logic"]
["Size"]
["Generate Script?","Y"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["ProductKey","ProductKey","Key to Product",null,"1, 2, 3",null,"key","Key lookup from DimProduct.ProductKey",null,"int",null,null,"FK, PK","DimProduct.ProductKey","N"]
["CustomerKey","CustomerKey","Key to Customer",null,"1, 2, 3",null,"key","Key lookup from DimCustomer.CustomerKey",null,"int",null,null,"FK,","DimCustomer.CustomerKey","N"]
["EmployeeKey","EmployeeKey","Key to Customer",null,"1, 2, 3",null,"key","Key lookup from DimEmployee.EmployeeKey",null,"int",null,null,"FK","DimEmployee.EmployeeKey","N"]
["OrderDateKey","OrderDateKey","Key to Date (for Orders)",null,20120108,null,"key","Key lookup from DimDate.DateKey",null,"int",null,null,"FK","DimDate.DateKey","N"]
["ShippedDateKey","ShippedDateKey","Key to Date (for Shipped)",null,20120108,null,"key","Key lookup from DimDate.DateKey",null,"int",null,null,"FK","DimDate.DateKey","N"]
["OrderID","OrderID","The natural key for the fact table, if any (eg order number)",null,"1,2,3…",null,"Exclude from cube",null,null,"int",null,null,"PK",null,"N",null,"Northwind","dbo","OrderDetails","OrderID","int"]
["Quantity","Quantity","Quantity sold of item on order",null,3,null,"Amounts",null,null,"smallint",null,null,null,null,"N",null,"Northwind","dbo","OrderDetails","Quantity","smallint"]
["ExtendedPriceAmount","ExtendedPriceAmount","Quantity * Unit Price of product",null,10,null,"Amounts",null,null,"money",null,null,null,null,"N",null,"Northwind","dbo","OrderDetails","UnitPrice","money"]
["DiscountAmount","DiscountAmount","Extended price * discount rate",null,2,null,"Amounts",null,null,"money",null,null,null,null,"N",0,"Northwind","dbo","OrderDetails","UnitPrice*Discount","money"]
["SoldAmount","SoldAmount","Extended price - Discount Amount",null,14.9,null,"Amounts",null,null,"money",null,null,null,null,"N",null,"Northwind","dbo","OrderDetails","Quantity*(1-Discount)*UnitPrice","money"]
[]
[null,null,null,null,null,null,null,null,null,null,null," "]

{"sheet":"Blank Dimension","index":9,"n_rows":23,"n_cols":21,"rows_kept":23,"cut":false,"hidden":true,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","BlankDimension"]
["Table Type","Dimension"]
["Display Name","Blank"]
["Database Schema"]
["Table Description","Always create a table description, which becomes a table extended property."]
["Comment","You can put technical information here -- it doesn't get copied into the database in any way."]
["Biz Filter Logic"]
["Size"]
["Generate Script?","N"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["BlankDimKey","Blank Dim Key","Surrogate primary key",-1,"1, 2, 3…","key",null,null,null,"int",null,null,"PK ID",null,"N",null,"Derived"]
["BKBlankDimID","Blank Dim ID","Business key from source system (aka natural key)",-1,null,"key",null,null,null,"nvarchar",10,null,null,null,"N"]
["Attribute1","Attribute1","Always describe your columns","Unk Attribute1",null,1,null,null,null,"nvarchar",50,null,null,null,"N"]
["Attribute2","Attribute2","Always describe your columns","Unk Attribute2",null,2,null,null,null,"nvarchar",50,null,null,null,"N"]
["Attribute3","Attribute3","Always describe your columns","Unk Attribute3",null,2,null,null,null,"nvarchar",50,null,null,null,"N"]
["RowIsCurrent","Row Is Current","Is this the current row for this member (Y/N)?","Y","Y, N","n/a","Exclude from cube","Standard SCD-2",null,"nchar",1,null,null,null,"N",null,"Derived"]
["RowStartDate","Row Start Date","When did this row become valid for this member?","1900-01-01","2011-01-24","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N",null,"Derived"]
["RowEndDate","Row End Date","When did this row become invalid? (12/31/9999 if current row)","9999-12-31","1/14/1998, 12/31/9999","n/a","Exclude from cube","Standard SCD-2",null,"datetime",null,null,null,null,"N","9999-12-31","Derived"]
["RowChangeReason","Row Change Reason","Why did the row change last?","N/A",null,"n/a","Exclude from cube","Standard SCD-2",null,"nvarchar",200,null,null,null,"N",null,"Derived"]
["InsertAuditKey","InsertAuditKey","What process loaded this row?",-1,null,"n/a","Exclude from cube","Standard Audit dim",null,"int",null,null,"FK","DimAudit.AuditKey","N",null,"Derived"]
["UpdateAuditKey","UpdateAuditKey","What process most recently updated this row?",-1,null,"n/a","Exclude from cube","Standard Audit dim",null,"int",null,null,"FK","DimAudit.AuditKey","N",null,"Derived"]

{"sheet":"Blank Fact","index":10,"n_rows":41,"n_cols":21,"rows_kept":41,"cut":false,"hidden":true,"merged":[[10,9,10,15],[10,16,10,20]]}
["Table Name","BlankFact"]
["Table Type","Fact"]
["Display Name","Blank Fact"]
["Database Schema"]
["Table Description","Always create a table description, which becomes a table extended property."]
["Comment","You can put technical information here -- it doesn't get copied into the database in any way."]
["Biz Filter Logic"]
["Size"]
["Generate Script?","N"]
[]
[null,null,null,null,null,null,null,null,null,"Target",null,null,null,null,null,null,"Source"]
["Column Name","Display Name","Description","Unknown Member","Example Values","SCD  Type","Display Folder","ETL Rules","Comments","Datatype","Size","Precision","Key?","FK To","NULL?","Default Value","Source System","Source Schema","Source Table","Source Field Name","Source Datatype"]
["Dim1Key","Dim1 Key","Key to Dim1",null,"1, 2, 3",null,"key","Key lookup from Sales.CurrencyRate.FromCurrencyCode",null,"smallint",null,null,"FK","Dim1.Dim1Key","N","ETL Process"]
["Dim2Key","Dim2 Key","Key to Dim2",null,"1, 2, 3",null,"key","Key lookup from Sales.CurrencyRate.CurrencyRateDate",null,"int",null,null,"FK","Dim2.Dim2Key","N","ETL Process"]
["InsertAuditKey","Insert Audit Key","Key to Audit dimension for row insertion",null,"1, 2, 3",null,"key","Standard auditing",null,"int",null,null,"FK","DimAudit.AuditKey","N","ETL Process"]
["UpdateAuditKey","Update Audit Key","Key to Audit dimension for row update",-2,"1, 2, 3",null,"key","Standard auditing",null,"int",null,null,"FK","DimAudit.AuditKey","N","ETL Process"]
["BKFactTable","BK Fact Table","The natural key for the fact table, if any (eg order number)",null,null,null,"Exclude from cube",null,null,"int",null,null,null,null,"Y"]
["Fact1","Fact 1","Always add a description!",null,null,null,"Counts & rates",null,null,"float",null,null,null,null,"Y"]
["Fact2","Fact 2","Always add a description!",null,null,null,"Counts & rates",null,null,"float",null,null,null,null,"Y"]
["Fact3","Fact 3","Always add a description!",null,null,null,"Amounts",null,null,"money",null,null,null,null,"Y"]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[null,null,null,null,null,null,null,null,null,null,null," "]

{"sheet":"Sheet1","index":11,"n_rows":792,"n_cols":1,"rows_kept":792,"cut":false,"hidden":false,"merged":[]}
["/****** Object:  Database UNKNOWN    Script Date: 3/22/2025 12:32:40 PM ******/"]
["/*"]
["Kimball Group, The Microsoft Data Warehouse Toolkit"]
["Generate a database from the datamodel worksheet, version: 4"]
[]
["You can use this Excel workbook as a data modeling tool during the logical design phase of your project."]
["As discussed in the book, it is in some ways preferable to a real data modeling tool during the inital design."]
["We expect you to move away from this spreadsheet and into a real modeling tool during the physical design phase."]
["The authors provide this macro so that the spreadsheet isn't a dead-end. You can 'import' into your"]
["data modeling tool by generating a database using this script, then reverse-engineering that database into"]
["your tool."]
[]
["Uncomment the next lines if you want to drop and create the database"]
["*/"]
["/*"]
["DROP DATABASE UNKNOWN"]
["GO"]
["CREATE DATABASE UNKNOWN"]
["GO"]
["ALTER DATABASE UNKNOWN"]
["SET RECOVERY SIMPLE"]
["GO"]
["*/"]
["USE UNKNOWN"]
[";"]
["IF EXISTS (SELECT Name from sys.extended_properties where Name = 'Description')"]
["    EXEC sys.sp_dropextendedproperty @name = 'Description'"]
["EXEC sys.sp_addextendedproperty @name = 'Description', @value = 'Default description - you should change this.'"]
[";"]
[]
[]
[]
[]
[]
["-- Create a schema to hold user views (set schema name on home page of workbook)."]
["-- It would be good to do this only if the schema doesn't exist already."]
["GO"]
["CREATE SCHEMA northwind"]
["GO"]
[]
[]
[]
[]
[]
[]
["/* Drop table northwind.DimCustomer */"]
["IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'northwind.DimCustomer') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)"]
["DROP TABLE northwind.DimCustomer "]
[";"]
[]
["/* Create table northwind.DimCustomer */"]
["CREATE TABLE northwind.DimCustomer ("]
["   [CustomerKey]  int IDENTITY  NOT NULL"]
[",  [CustomerID]  nvarchar(5)   NOT NULL"]
[",  [CompanyName]  nvarchar(40)   NOT NULL"]
[",  [ContactName]  nvarchar(30)   NOT NULL"]
[",  [ContactTitle]  nvarchar(30)   NOT NULL"]
[",  [CustomerCountry]  nvarchar(15)   NOT NULL"]
[",  [CustomerRegion]  nvarchar(15)  DEFAULT 'N/A' NOT NULL"]
[",  [CustomerCity]  nvarchar(15)   NOT NULL"]
[",  [CustomerPostalCode]  nvarchar(10)   NOT NULL"]
[",  [RowIsCurrent]  bit  DEFAULT 1 NOT NULL"]
[",  [RowStartDate]  datetime  DEFAULT '12/31/1899' NOT NULL"]
[",  [RowEndDate]  datetime  DEFAULT '12/31/9999' NOT NULL"]
[",  [RowChangeReason]  nvarchar(200)   NULL"]
[", CONSTRAINT [PK_northwind.DimCustomer] PRIMARY KEY CLUSTERED "]
["( [CustomerKey] )"]
[") ON [PRIMARY]"]
[";"]
[]
["--Table extended properties..."]
["exec sys.sp_addextendedproperty @name=N'Table Type', @value=N'Dimension', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimCustomer"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Customer', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimCustomer"]
["exec sys.sp_addextendedproperty @name=N'Database Schema', @value=N'northwind', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimCustomer"]
["exec sys.sp_addextendedproperty @name=N'Table Description', @value=N'Customers dimension', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimCustomer"]
[";"]
[]
["SET IDENTITY_INSERT northwind.DimCustomer ON"]
[";"]
["INSERT INTO northwind.DimCustomer (CustomerKey, CustomerID, CompanyName, ContactName, ContactTitle, CustomerCountry, CustomerRegion, CustomerCity, CustomerPostalCode, RowIsCurrent, RowStartDate, RowEndDate, RowChangeReason)"]
["VALUES (-1, 'NONE', 'No Customer', 'None', 'None', 'None', 'None', 'None', 'None', 1, '12/31/1899', '12/31/9999', 'N/A')"]
[";"]
["SET IDENTITY_INSERT northwind.DimCustomer OFF"]
[";"]
[]
["-- User-oriented view definition"]
["GO"]
["IF EXISTS (select * from sys.views where object_id=OBJECT_ID(N'[northwind].[Customer]'))"]
["DROP VIEW [northwind].[Customer]"]
["GO"]
["CREATE VIEW [northwind].[Customer] AS "]
["SELECT [CustomerKey] AS [CustomerKey]"]
[", [CustomerID] AS [CustomerID]"]
[", [CompanyName] AS [CompanyName]"]
[", [ContactName] AS [ContactName]"]
[", [ContactTitle] AS [ContactTitle]"]
[", [CustomerCountry] AS [CustomerCountry]"]
[", [CustomerRegion] AS [CustomerRegion]"]
[", [CustomerCity] AS [CustomerCity]"]
[", [CustomerPostalCode] AS [CustomerPostalCode]"]
[", [RowIsCurrent] AS [Row Is Current]"]
[", [RowStartDate] AS [Row Start Date]"]
[", [RowEndDate] AS [Row End Date]"]
[", [RowChangeReason] AS [Row Change Reason]"]
["FROM northwind.DimCustomer"]
["GO"]
[]
["--Column extended properties"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CompanyName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ContactName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ContactTitle', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerCountry', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerRegion', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerCity', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerPostalCode', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Is Current', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Start Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row End Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Change Reason', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Surrogate primary key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Business key from source system (aka natural key)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Customer''s company Name', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Name of contact at the company', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Contact''s job title', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Country of origin ', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'State or province', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Customer''s City', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Customer''s postal code', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Is this the current row for this member (Y/N)?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'When did this row become valid for this member?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'When did this row become invalid? (12/31/9999 if current row)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Why did the row change last?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3…', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'ALFKI', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Bon app''', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Pedro Alfanso', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Owner, Sales Rep.', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'USA', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'WA', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Seattle', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'13244', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'TRUE, FALSE', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1/24/2011', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1/14/1998, 12/31/9999', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Customers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'CustomerID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'CompanyName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'ContactName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'ContactTitle', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'Country', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'Region', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'City', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'PostalCode', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CompanyName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'ContactTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCountry'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerRegion'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerCity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'nvarchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimCustomer', @level2type=N'COLUMN', @level2name=N'CustomerPostalCode'; "]
[";"]
[]
[]
[]
[]
[]
["/* Drop table northwind.DimDate */"]
["IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'northwind.DimDate') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)"]
["DROP TABLE northwind.DimDate "]
[";"]
[]
["/* Create table northwind.DimDate */"]
["CREATE TABLE northwind.DimDate ("]
["   [DateKey]  int   NOT NULL"]
[",  [Date]  date   NULL"]
[",  [FullDateUSA]  nchar(11)   NOT NULL"]
[",  [DayOfWeek]  tinyint   NOT NULL"]
[",  [DayName]  nchar(10)   NOT NULL"]
[",  [DayOfMonth]  tinyint   NOT NULL"]
[",  [DayOfYear]  smallint   NOT NULL"]
[",  [WeekOfYear]  tinyint   NOT NULL"]
[",  [MonthName]  nchar(10)   NOT NULL"]
[",  [MonthOfYear]  tinyint   NOT NULL"]
[",  [Quarter]  tinyint   NOT NULL"]
[",  [QuarterName]  nchar(10)   NOT NULL"]
[",  [Year]  smallint   NOT NULL"]
[",  [IsWeekday]  bit  DEFAULT 0 NOT NULL"]
[", CONSTRAINT [PK_northwind.DimDate] PRIMARY KEY CLUSTERED "]
["( [DateKey] )"]
[") ON [PRIMARY]"]
[";"]
[]
["--Table extended properties..."]
["exec sys.sp_addextendedproperty @name=N'Table Type', @value=N'Dimension', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimDate"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Date', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimDate"]
["exec sys.sp_addextendedproperty @name=N'Database Schema', @value=N'northwind', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimDate"]
["exec sys.sp_addextendedproperty @name=N'Table Description', @value=N'Date dimension contains one row for every day, beginning at 1/1/2005. There may also be rows for \"hasn''t happened yet.\"', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimDate"]
[";"]
[]
["INSERT INTO northwind.DimDate (DateKey, Date, FullDateUSA, DayOfWeek, DayName, DayOfMonth, DayOfYear, WeekOfYear, MonthName, MonthOfYear, Quarter, QuarterName, Year, IsWeekday)"]
["VALUES (-1, '', 'Unk date', 0, 'Unk date', 0, 0, 0, 'Unk month', 0, 0, 'Unk qtr', 0, 0)"]
[";"]
[]
["-- User-oriented view definition"]
["GO"]
["IF EXISTS (select * from sys.views where object_id=OBJECT_ID(N'[northwind].[Date]'))"]
["DROP VIEW [northwind].[Date]"]
["GO"]
["CREATE VIEW [northwind].[Date] AS "]
["SELECT [DateKey] AS [DateKey]"]
[", [Date] AS [Date]"]
[", [FullDateUSA] AS [FullDateUSA]"]
[", [DayOfWeek] AS [DayOfWeek]"]
[", [DayName] AS [DayName]"]
[", [DayOfMonth] AS [DayOfMonth]"]
[", [DayOfYear] AS [DayOfYear]"]
[", [WeekOfYear] AS [WeekOfYear]"]
[", [MonthName] AS [MonthName]"]
[", [MonthOfYear] AS [MonthOfYear]"]
[", [Quarter] AS [Quarter]"]
[", [QuarterName] AS [QuarterName]"]
[", [Year] AS [Year]"]
[", [IsWeekday] AS [IsWeekday]"]
["FROM northwind.DimDate"]
["GO"]
[]
["--Column extended properties"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'DateKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Date'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'FullDateUSA', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'FullDateUSA'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'DayOfWeek', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfWeek'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'DayName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'DayOfMonth', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfMonth'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'DayOfYear', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'WeekOfYear', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'WeekOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'MonthName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'MonthOfYear', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Quarter', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Quarter'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'QuarterName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'QuarterName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Year', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Year'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'IsWeekday', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'IsWeekday'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Surrogate primary key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Full date as a SQL date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Date'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'String expression of the full date, eg MM/DD/YYYY', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'FullDateUSA'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Number of the day of week; Sunday = 1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfWeek'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Day name of week, eg Monday', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Number of the day in the month', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfMonth'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Number of the day in the year', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Week of year, 1..53', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'WeekOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Month name, eg January', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Month of year, 1..12', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Calendar quarter, 1..4', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Quarter'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Quarter name eg. First', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'QuarterName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Calendar year, eg 2010', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Year'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Is today a weekday', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'IsWeekday'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'20041123', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'38314', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Date'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'23-Nov-2004', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'FullDateUSA'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1..7', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfWeek'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Sunday', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1..31', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfMonth'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1..365', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1..52 or 53', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'WeekOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'November', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, …, 12', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3, 4', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Quarter'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'November', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'QuarterName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'2004', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Year'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 0', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'IsWeekday'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'FullDateUSA'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfWeek'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfMonth'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'WeekOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Quarter'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'QuarterName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Year'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'IsWeekday'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Date'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'FullDateUSA'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfWeek'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfMonth'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Calendar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'WeekOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Calendar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Calendar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Calendar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Quarter'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Calendar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'QuarterName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Calendar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Year'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Day', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'IsWeekday'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'In the form: yyyymmdd', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Date'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'FullDateUSA'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfWeek'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfMonth'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'DayOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'WeekOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'MonthOfYear'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Quarter'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'QuarterName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'Year'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimDate', @level2type=N'COLUMN', @level2name=N'IsWeekday'; "]
[";"]
[]
[]
[]
[]
[]
["/* Drop table northwind.DimProduct */"]
["IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'northwind.DimProduct') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)"]
["DROP TABLE northwind.DimProduct "]
[";"]
[]
["/* Create table northwind.DimProduct */"]
["CREATE TABLE northwind.DimProduct ("]
["   [ProductKey]  int IDENTITY  NOT NULL"]
[",  [ProductID]  int   NOT NULL"]
[",  [ProductName]  nvarchar(40)   NOT NULL"]
[",  [Discontinued]  nchar(1)  DEFAULT 'N' NOT NULL"]
[",  [SupplierName]  nvarchar(40)   NOT NULL"]
[",  [CategoryName]  nvarchar(15)   NOT NULL"]
[",  [RowIsCurrent]  bit  DEFAULT 1 NOT NULL"]
[",  [RowStartDate]  datetime  DEFAULT '12/31/1899' NOT NULL"]
[",  [RowEndDate]  datetime  DEFAULT '12/31/9999' NOT NULL"]
[",  [RowChangeReason]  nvarchar(200)   NULL"]
[", CONSTRAINT [PK_northwind.DimProduct] PRIMARY KEY CLUSTERED "]
["( [ProductKey] )"]
[") ON [PRIMARY]"]
[";"]
[]
["--Table extended properties..."]
["exec sys.sp_addextendedproperty @name=N'Table Type', @value=N'Dimension', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimProduct"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Product', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimProduct"]
["exec sys.sp_addextendedproperty @name=N'Database Schema', @value=N'northwind', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimProduct"]
["exec sys.sp_addextendedproperty @name=N'Table Description', @value=N'Products on an order (with supplier and category info)', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimProduct"]
[";"]
[]
["SET IDENTITY_INSERT northwind.DimProduct ON"]
[";"]
["INSERT INTO northwind.DimProduct (ProductKey, ProductID, ProductName, Discontinued, SupplierName, CategoryName, RowIsCurrent, RowStartDate, RowEndDate, RowChangeReason)"]
["VALUES (-1, -1, 'None', '?', 'None', 'None', 1, '12/31/1899', '12/31/9999', 'N/A')"]
[";"]
["SET IDENTITY_INSERT northwind.DimProduct OFF"]
[";"]
[]
["-- User-oriented view definition"]
["GO"]
["IF EXISTS (select * from sys.views where object_id=OBJECT_ID(N'[northwind].[Product]'))"]
["DROP VIEW [northwind].[Product]"]
["GO"]
["CREATE VIEW [northwind].[Product] AS "]
["SELECT [ProductKey] AS [ProductKey]"]
[", [ProductID] AS [ProductID]"]
[", [ProductName] AS [ProductName]"]
[", [Discontinued] AS [Discontinued]"]
[", [SupplierName] AS [SupplierName]"]
[", [CategoryName] AS [CategoryName]"]
[", [RowIsCurrent] AS [Row Is Current]"]
[", [RowStartDate] AS [Row Start Date]"]
[", [RowEndDate] AS [Row End Date]"]
[", [RowChangeReason] AS [Row Change Reason]"]
["FROM northwind.DimProduct"]
["GO"]
[]
["--Column extended properties"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ProductKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ProductID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ProductName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Discontinued', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'SupplierName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CategoryName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Is Current', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Start Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row End Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Change Reason', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Surrogate primary key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Business key from source system (aka natural key)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Name of product', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Is the product discontinued?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Name of supplier for product', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Product''s category', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Is this the current row for this member (Y/N)?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'When did this row become valid for this member?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'When did this row become invalid? (12/31/9999 if current row)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Why did the row change last?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3…', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1,2,3,…', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Chi Tea', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'False', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Bigfoot Breweries', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'Seafood', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'TRUE, FALSE', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1/24/2011', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1/14/1998, 12/31/9999', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Products', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Products', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Products', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Suppliers', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Categories', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'ProductID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'ProductName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'Discontinued', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'SupplierName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'CategoryName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'int', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'varchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'ProductName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'bit', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'Discontinued'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'varchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'SupplierName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'varchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimProduct', @level2type=N'COLUMN', @level2name=N'CategoryName'; "]
[";"]
[]
[]
[]
[]
[]
["/* Drop table northwind.DimEmployee */"]
["IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'northwind.DimEmployee') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)"]
["DROP TABLE northwind.DimEmployee "]
[";"]
[]
["/* Create table northwind.DimEmployee */"]
["CREATE TABLE northwind.DimEmployee ("]
["   [EmployeeKey]  int IDENTITY  NOT NULL"]
[",  [EmployeeID]  int   NOT NULL"]
[",  [EmployeeName]  nvarchar(40)   NOT NULL"]
[",  [EmployeeTitle]  nvarchar(30)   NOT NULL"]
[",  [RowIsCurrent]  bit   DEFAULT 1 NOT NULL"]
[",  [RowStartDate]  datetime  DEFAULT '12/31/1899' NOT NULL"]
[",  [RowEndDate]  datetime  DEFAULT '12/31/9999' NOT NULL"]
[",  [RowChangeReason]  nvarchar(200)   NULL"]
[", CONSTRAINT [PK_northwind.DimEmployee] PRIMARY KEY CLUSTERED "]
["( [EmployeeKey] )"]
[") ON [PRIMARY]"]
[";"]
[]
["--Table extended properties..."]
["exec sys.sp_addextendedproperty @name=N'Table Type', @value=N'Dimension', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimEmployee"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Employee', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimEmployee"]
["exec sys.sp_addextendedproperty @name=N'Database Schema', @value=N'northwind', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimEmployee"]
["exec sys.sp_addextendedproperty @name=N'Table Description', @value=N'Employee table', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=DimEmployee"]
[";"]
[]
["SET IDENTITY_INSERT northwind.DimEmployee ON"]
[";"]
["INSERT INTO northwind.DimEmployee (EmployeeKey, EmployeeID, EmployeeName, EmployeeTitle, RowIsCurrent, RowStartDate, RowEndDate, RowChangeReason)"]
["VALUES (-1, -1, 'None', 'None', 1, '12/31/1899', '12/31/9999', 'N/A')"]
[";"]
["SET IDENTITY_INSERT northwind.DimEmployee OFF"]
[";"]
[]
["-- User-oriented view definition"]
["GO"]
["IF EXISTS (select * from sys.views where object_id=OBJECT_ID(N'[northwind].[Employee]'))"]
["DROP VIEW [northwind].[Employee]"]
["GO"]
["CREATE VIEW [northwind].[Employee] AS "]
["SELECT [EmployeeKey] AS [EmployeeKey]"]
[", [EmployeeID] AS [EmployeeID]"]
[", [EmployeeName] AS [EmployeeName]"]
[", [EmployeeTitle] AS [EmployeeTitle]"]
[", [RowIsCurrent] AS [Row Is Current]"]
[", [RowStartDate] AS [Row Start Date]"]
[", [RowEndDate] AS [Row End Date]"]
[", [RowChangeReason] AS [Row Change Reason]"]
["FROM northwind.DimEmployee"]
["GO"]
[]
["--Column extended properties"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'EmployeeKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'EmployeeID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'EmployeeName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'EmployeeTitle', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Is Current', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Start Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row End Date', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Row Change Reason', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Surrogate primary key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Business key from source system (aka natural key)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Employee''s Name', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Employee''s Job Title', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Is this the current row for this member (Y/N)?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'When did this row become valid for this member?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'When did this row become invalid? (12/31/9999 if current row)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Why did the row change last?', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3…', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'TRUE, FALSE', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1/24/2011', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1/14/1998, 12/31/9999', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'1', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'SCD  Type', @value=N'n/a', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Standard SCD-2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowIsCurrent'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowStartDate'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowEndDate'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Derived', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'RowChangeReason'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Employees', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Employees', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'Employees', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'EmployeeID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'EmployeeName', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'EmployeeTitle', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'int', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'varchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeName'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'varchar', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'DimEmployee', @level2type=N'COLUMN', @level2name=N'EmployeeTitle'; "]
[";"]
[]
[]
[]
[]
[]
["/* Drop table northwind.FactSales */"]
["IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'northwind.FactSales') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)"]
["DROP TABLE northwind.FactSales "]
[";"]
[]
["/* Create table northwind.FactSales */"]
["CREATE TABLE northwind.FactSales ("]
["   [ProductKey]  int   NOT NULL"]
[",  [CustomerKey]  int   NOT NULL"]
[",  [EmployeeKey]  int   NOT NULL"]
[",  [OrderDateKey]  int   NOT NULL"]
[",  [ShippedDateKey]  int   NOT NULL"]
[",  [OrderID]  int   NOT NULL"]
[",  [Quantity]  smallint   NOT NULL"]
[",  [ExtendedPriceAmount]  money   NOT NULL"]
[",  [DiscountAmount]  money  DEFAULT 0 NOT NULL"]
[",  [SoldAmount]  money   NOT NULL"]
[", CONSTRAINT [PK_northwind.FactSales] PRIMARY KEY NONCLUSTERED "]
["( [ProductKey], [OrderID] )"]
[") ON [PRIMARY]"]
[";"]
[]
["--Table extended properties..."]
["exec sys.sp_addextendedproperty @name=N'Table Type', @value=N'Fact', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=FactSales"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Sales', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=FactSales"]
["exec sys.sp_addextendedproperty @name=N'Database Schema', @value=N'northwind', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=FactSales"]
["exec sys.sp_addextendedproperty @name=N'Table Description', @value=N'Sales order information', @level0type=N'SCHEMA', @level0name=northwind, @level1type=N'TABLE', @level1name=FactSales"]
[";"]
[]
["-- User-oriented view definition"]
["GO"]
["IF EXISTS (select * from sys.views where object_id=OBJECT_ID(N'[northwind].[Sales]'))"]
["DROP VIEW [northwind].[Sales]"]
["GO"]
["CREATE VIEW [northwind].[Sales] AS "]
["SELECT [ProductKey] AS [ProductKey]"]
[", [CustomerKey] AS [CustomerKey]"]
[", [EmployeeKey] AS [EmployeeKey]"]
[", [OrderDateKey] AS [OrderDateKey]"]
[", [ShippedDateKey] AS [ShippedDateKey]"]
[", [OrderID] AS [OrderID]"]
[", [Quantity] AS [Quantity]"]
[", [ExtendedPriceAmount] AS [ExtendedPriceAmount]"]
[", [DiscountAmount] AS [DiscountAmount]"]
[", [SoldAmount] AS [SoldAmount]"]
["FROM northwind.FactSales"]
["GO"]
[]
["--Column extended properties"]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ProductKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'CustomerKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'EmployeeKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'OrderDateKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ShippedDateKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ShippedDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'OrderID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'Quantity', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'ExtendedPriceAmount', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'DiscountAmount', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Display Name', @value=N'SoldAmount', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Key to Product', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Key to Customer', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Key to Customer', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Key to Date (for Orders)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Key to Date (for Shipped)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ShippedDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'The natural key for the fact table, if any (eg order number)', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Quantity sold of item on order', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Quantity * Unit Price of product', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Extended price * discount rate', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Description', @value=N'Extended price - Discount Amount', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1, 2, 3', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'20120108', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'20120108', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ShippedDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'1,2,3…', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'3', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'10', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'2', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Example Values', @value=N'14.9', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'key', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ShippedDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Exclude from cube', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Amounts', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Amounts', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Amounts', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Display Folder', @value=N'Amounts', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Key lookup from DimProduct.ProductKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ProductKey'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Key lookup from DimCustomer.CustomerKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'CustomerKey'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Key lookup from DimEmployee.EmployeeKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'EmployeeKey'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Key lookup from DimDate.DateKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'ETL Rules', @value=N'Key lookup from DimDate.DateKey', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ShippedDateKey'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source System', @value=N'Northwind', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Schema', @value=N'dbo', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'OrderDetails', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'OrderDetails', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'OrderDetails', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'OrderDetails', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Table', @value=N'OrderDetails', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'OrderID', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'Quantity', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'UnitPrice', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'UnitPrice*Discount', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Field Name', @value=N'Quantity*(1-Discount)*UnitPrice', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'int', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'OrderID'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'smallint', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'Quantity'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'money', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'ExtendedPriceAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'money', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'DiscountAmount'; "]
["exec sys.sp_addextendedproperty @name=N'Source Datatype', @value=N'money', @level0type=N'SCHEMA', @level0name=N'northwind', @level1type=N'TABLE', @level1name=N'FactSales', @level2type=N'COLUMN', @level2name=N'SoldAmount'; "]
[";"]
["ALTER TABLE northwind.FactSales ADD CONSTRAINT"]
["   FK_northwind_FactSales_ProductKey FOREIGN KEY"]
["   ("]
["   ProductKey"]
["   ) REFERENCES DimProduct"]
["   ( ProductKey )"]
["     ON UPDATE  NO ACTION"]
["     ON DELETE  NO ACTION"]
[";"]
[" "]
["ALTER TABLE northwind.FactSales ADD CONSTRAINT"]
["   FK_northwind_FactSales_CustomerKey FOREIGN KEY"]
["   ("]
["   CustomerKey"]
["   ) REFERENCES DimCustomer"]
["   ( CustomerKey )"]
["     ON UPDATE  NO ACTION"]
["     ON DELETE  NO ACTION"]
[";"]
[" "]
["ALTER TABLE northwind.FactSales ADD CONSTRAINT"]
["   FK_northwind_FactSales_EmployeeKey FOREIGN KEY"]
["   ("]
["   EmployeeKey"]
["   ) REFERENCES DimEmployee"]
["   ( EmployeeKey )"]
["     ON UPDATE  NO ACTION"]
["     ON DELETE  NO ACTION"]
[";"]
[" "]
["ALTER TABLE northwind.FactSales ADD CONSTRAINT"]
["   FK_northwind_FactSales_OrderDateKey FOREIGN KEY"]
["   ("]
["   OrderDateKey"]
["   ) REFERENCES DimDate"]
["   ( DateKey )"]
["     ON UPDATE  NO ACTION"]
["     ON DELETE  NO ACTION"]
[";"]
[" "]
["ALTER TABLE northwind.FactSales ADD CONSTRAINT"]
["   FK_northwind_FactSales_ShippedDateKey FOREIGN KEY"]
["   ("]
["   ShippedDateKey"]
["   ) REFERENCES DimDate"]
["   ( DateKey )"]
["     ON UPDATE  NO ACTION"]
["     ON DELETE  NO ACTION"]
[";"]
[" "]