-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExtendedAttributes.sql
More file actions
30 lines (30 loc) · 1.3 KB
/
ExtendedAttributes.sql
File metadata and controls
30 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--------------------------------------------------------------------------------------------------------------------------------
-- EXTENDED ATTRIBUTES (TABLE)
--------------------------------------------------------------------------------------------------------------------------------
-- Provides a storage AttributeXml (in XML format) for attribute key/value pairs. Attributes can also be stored in the
-- Attributes table. The difference is that the latter limits attribute values to 255 characters per AttributeValue,
-- whereas the AttributeXml offers virtually unlimited storage capacity (at least in practical terms).
--------------------------------------------------------------------------------------------------------------------------------
CREATE
TABLE [dbo].[ExtendedAttributes] (
[TopicID] INT NOT NULL,
[AttributesXml] XML NOT NULL,
[DateModified] DATETIME
CONSTRAINT [DF_ExtendedAttributes_DateModified] DEFAULT (
GetDate()
) NOT NULL,
[Version] DATETIME
CONSTRAINT [DF_ExtendedAttributes_Version] DEFAULT (
GetDate()
) NOT NULL,
CONSTRAINT [PK_ExtendedAttributes] PRIMARY KEY CLUSTERED (
[TopicID] ASC,
[Version] DESC
),
CONSTRAINT [FK_ExtendedAttributes_Topics]
FOREIGN KEY ( [TopicID]
)
REFERENCES [dbo].[Topics] (
[TopicID]
)
);