Tables [dbo].[BuildingAddress]
Properties
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
Row Count (~)0
Created9:02:41 AM Friday, December 7, 2018
Last Modified9:02:42 AM Friday, December 7, 2018
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentity
Cluster Primary Key PK_BuildingAddress: BuildingAddressIDBuildingAddressIDint4
No
1 - 1
Foreign Keys FK_BuildingAddress_Buildings: [dbo].[Buildings].BuildingFIDIndexes ix_BuildingAddress_Building: BuildingFIDBuildingFIDint4
No
Foreign Keys FK_BuildingAddress_AddressType: [dbo].[AddressType].AddressTypeFIDCheck Constraints CK_BuildingAddress_MainAddressType : ([dbo].[GetAddressTypeName]([AddressTypeFID])='Main')AddressTypeFIDint4
No
Address1[dbo].[Address]256
Yes
Address2[dbo].[Address]256
Yes
Address3[dbo].[Address]256
Yes
City[dbo].[AddressCity]26
Yes
State[dbo].[AddressState]2
Yes
PostalCode[dbo].[AddressPostalCode]10
Yes
Foreign Keys FK_BuildingAddress_CountryCodeStandard: [dbo].[CountryCodeStandard].CountryCodeStandardFIDCountryCodeStandardFIDint4
Yes
Indexes Indexes
NameColumnsUnique
Cluster Primary Key PK_BuildingAddress: BuildingAddressIDPK_BuildingAddressBuildingAddressID
Yes
ix_BuildingAddress_BuildingBuildingFID
Check Constraints Check Constraints
NameOn ColumnConstraint
CK_BuildingAddress_MainAddressTypeAddressTypeFID([dbo].[GetAddressTypeName]([AddressTypeFID])='Main')
Foreign Keys Foreign Keys
NameDeleteColumns
FK_BuildingAddress_AddressTypeAddressTypeFID->[dbo].[AddressType].[AddressTypeID]
FK_BuildingAddress_BuildingsCascadeBuildingFID->[dbo].[Buildings].[BuildingID]
FK_BuildingAddress_CountryCodeStandardCountryCodeStandardFID->[dbo].[CountryCodeStandard].[CountryCodeStandardID]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[BuildingAddress]
(
[BuildingAddressID] [int] NOT NULL IDENTITY(1, 1),
[BuildingFID] [int] NOT NULL,
[AddressTypeFID] [int] NOT NULL,
[Address1] [dbo].[Address] NULL,
[Address2] [dbo].[Address] NULL,
[Address3] [dbo].[Address] NULL,
[City] [dbo].[AddressCity] NULL,
[State] [dbo].[AddressState] NULL,
[PostalCode] [dbo].[AddressPostalCode] NULL,
[CountryCodeStandardFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BuildingAddress] ADD CONSTRAINT [CK_BuildingAddress_MainAddressType] CHECK (([dbo].[GetAddressTypeName]([AddressTypeFID])='Main'))
GO
ALTER TABLE [dbo].[BuildingAddress] ADD CONSTRAINT [PK_BuildingAddress] PRIMARY KEY CLUSTERED  ([BuildingAddressID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ix_BuildingAddress_Building] ON [dbo].[BuildingAddress] ([BuildingFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BuildingAddress] ADD CONSTRAINT [FK_BuildingAddress_AddressType] FOREIGN KEY ([AddressTypeFID]) REFERENCES [dbo].[AddressType] ([AddressTypeID])
GO
ALTER TABLE [dbo].[BuildingAddress] ADD CONSTRAINT [FK_BuildingAddress_Buildings] FOREIGN KEY ([BuildingFID]) REFERENCES [dbo].[Buildings] ([BuildingID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[BuildingAddress] ADD CONSTRAINT [FK_BuildingAddress_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
GRANT SELECT ON  [dbo].[BuildingAddress] TO [MssExec]
GRANT INSERT ON  [dbo].[BuildingAddress] TO [MssExec]
GRANT DELETE ON  [dbo].[BuildingAddress] TO [MssExec]
GRANT UPDATE ON  [dbo].[BuildingAddress] TO [MssExec]
GO
Uses