use Repository
go
create schema [Contact] authorization [RepositoryOwner]
go
create table [Contact].[AddressesTable](
[Id] bigint NOT NULL,
[Folder] [Repository.Item].[FolderId] NOT NULL,
[Street] nvarchar(max) NOT NULL,
[City] nvarchar(max) NOT NULL,
[State] nvarchar(max) NOT NULL,
[ZipCode] int NOT NULL,
constraint [PK_Addresses] primary key clustered
(
[Id] asc
) on [PRIMARY]
) on [PRIMARY]
go
create view [Contact].[Addresses]
([Id], [Folder], [Street], [City], [State], [ZipCode])
as
select top (9223372036854775807) [AT].[Id], [AT].[Folder], [AT].[Street],
[AT].[City], [AT].[State], [AT].[ZipCode]
from [Contact].[AddressesTable] as [AT] with (readcommitted)
inner join [Repository.Item].[ReadableFolders]() as [RCV] on [AT].[Folder] = [RCV].[Folder];
go