Views [Sales].[vStoreWithDemographics]
Stores (including demographics) that sell Adventure Works Cycles products to consumers.
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
ANSI Nulls OnTrue
Quoted Identifier OnTrue
Created13:14:55 14 marca 2012
Last Modified13:14:55 14 marca 2012
NameData TypeMax Length (Bytes)
BusinessEntityIDint4
Name[dbo].[Name]100
AnnualSalesmoney8
AnnualRevenuemoney8
BankNamenvarchar(50)100
BusinessTypenvarchar(5)10
YearOpenedint4
Specialtynvarchar(50)100
SquareFeetint4
Brandsnvarchar(30)60
Internetnvarchar(30)60
NumberEmployeesint4

CREATE VIEW [Sales].[vStoreWithDemographics] AS
SELECT
   s.[BusinessEntityID]
   ,s.[Name]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/AnnualSales)[1]'
, 'money') AS [AnnualSales]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/AnnualRevenue)[1]'
, 'money') AS [AnnualRevenue]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/BankName)[1]'
, 'nvarchar(50)') AS [BankName]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/BusinessType)[1]'
, 'nvarchar(5)') AS [BusinessType]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/YearOpened)[1]'
, 'integer') AS [YearOpened]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/Specialty)[1]'
, 'nvarchar(50)') AS [Specialty]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/SquareFeet)[1]'
, 'integer') AS [SquareFeet]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/Brands)[1]'
, 'nvarchar(30)') AS [Brands]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/Internet)[1]'
, 'nvarchar(30)') AS [Internet]
   ,s.[Demographics].value('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
       (/StoreSurvey/NumberEmployees)[1]'
, 'integer') AS [NumberEmployees]
FROM [Sales].[Store] s;
GO
EXEC sp_addextendedproperty N'MS_Description', N'Stores (including demographics) that sell Adventure Works Cycles products to consumers.', 'SCHEMA', N'Sales', 'VIEW', N'vStoreWithDemographics', NULL, NULL
GO