Description
Cross-reference table mapping products to special offer discounts.
Table properties
| name | value |
|---|
| name | [Sales].[SpecialOfferProduct] |
| created | Mar 19 2009 9:08PM |
| modified | Mar 19 2009 9:08PM
|
| ansi nulls | on
|
| quoted identifier | on
|
| row count | 538 |
| Size of data | 24 kb |
| Size of indexes | 64 kb |
| Maximum size of a single row | 32 bytes |
Columns
| column | datatype | length | bytes | default | nulls | PK | FK | UQ | computed | comment |
|---|
| SpecialOfferID | int | 10 | 4 | | no
| composite PK
| SpecialOffer.SpecialOfferID
|
| no
| Primary key for SpecialOfferProduct records.
|
| ProductID | int | 10 | 4 | | no
| composite PK
| Product.ProductID
|
| no
| Product identification number. Foreign key to Product.ProductID.
|
| rowguid | uniqueidentifier | 36 | 16 | (newid()) | no
|
| |
| no
| ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
|
| ModifiedDate | datetime | 23 | 8 | (getdate()) | no
|
| |
| no
| Date and time the record was last updated.
|
Indexes
References
Referenced by
Foreign key graph
Foreign keys
| name | columns | foreign columns | type | comment |
|---|
| FK_SpecialOfferProduct_Product_ProductID | ProductID | Product.ProductID |
| Foreign key constraint referencing Product.ProductID.
|
| FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID | SpecialOfferID | SpecialOffer.SpecialOfferID |
| Foreign key constraint referencing SpecialOffer.SpecialOfferID.
|
Defaults
Dependency graph
Sample rows
| SpecialOfferID | ProductID | rowguid | ModifiedDate |
|---|
| 1
| 680
| bb30b868-d86c-4557-8db2-4b2d0a83a0fb
| 5/2/2001 12:00:00 AM
|
| 1
| 706
| b3c9a4b1-2ae6-4cba-b552-1f206c9f4c1f
| 5/2/2001 12:00:00 AM
|
| 1
| 707
| 27b711fe-0b77-4ea4-ad1a-7c239956bef4
| 5/2/2001 12:00:00 AM
|
| 1
| 708
| 46cbb78b-246e-4d69-9bd6-e521277c1078
| 5/2/2001 12:00:00 AM
|
| 1
| 709
| cf102aa0-055f-4d2b-8b98-04b161758ea8
| 5/2/2001 12:00:00 AM
|
| 1
| 710
| 63718da1-464b-4325-9514-cdee46cb124f
| 5/2/2001 12:00:00 AM
|
| 1
| 711
| 457eb971-d1c9-48ca-b947-ae7e1b114377
| 5/2/2001 12:00:00 AM
|
| 1
| 712
| 5b948448-bae5-4f2a-a1f3-8203e892fd24
| 5/2/2001 12:00:00 AM
|
| 1
| 713
| 07768f40-6e46-430f-ac1a-ff6a3629729c
| 5/2/2001 12:00:00 AM
|
| 1
| 714
| 85004bce-c74a-4d4e-8d17-3157991a1400
| 5/2/2001 12:00:00 AM
|
Code
CREATE TABLE [Sales].[SpecialOfferProduct](
[SpecialOfferID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[SpecialOfferID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_SpecialOfferProduct_SpecialOfferID_ProductID] PRIMARY KEY CLUSTERED
(
[SpecialOfferID] ASC,
[ProductID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE [Sales].[SpecialOfferProduct] WITH CHECK ADD CONSTRAINT [FK_SpecialOfferProduct_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Production].[Product] ([ProductID])
ALTER TABLE [Sales].[SpecialOfferProduct] CHECK CONSTRAINT [FK_SpecialOfferProduct_Product_ProductID]
ALTER TABLE [Sales].[SpecialOfferProduct] WITH CHECK ADD CONSTRAINT [FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID] FOREIGN KEY([SpecialOfferID])
REFERENCES [Sales].[SpecialOffer] ([SpecialOfferID])
ALTER TABLE [Sales].[SpecialOfferProduct] CHECK CONSTRAINT [FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID]
ALTER TABLE [Sales].[SpecialOfferProduct] ADD CONSTRAINT [DF_SpecialOfferProduct_rowguid] DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Sales].[SpecialOfferProduct] ADD CONSTRAINT [DF_SpecialOfferProduct_ModifiedDate] DEFAULT (getdate()) FOR [ModifiedDate]