??????SQL Server?У?SQL????????????????????????????м????????м???????????????????
???????????????????м???????У?????ο???????????????????Ч????м???????????????????м??????????Ч????ν????ο????????????????????????????????????????????Щ???????????????????а????????????Check?????
????????????????????м???????????ν?????????????????????????????????


????
?????1.?????

?????????????????1=2???????????????????????????????κ????????????б??????????1??м???????????????賣?????????1=2????false???????????
???????Check?????
????Check????????????л???е???????????????????Щ???Check???????????????????????????????????翴??????????


????
?????2.??Check??????????????????

?????2????????????????????????????????Check?????????????????????????£?
CREATE TABLE [dbo].[Test2007](
[ProductReviewID] [int] IDENTITY(1??1) NOT NULL??
[ReviewDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Test2007]  WITH CHECK ADD  CONSTRAINT [CK_Test2007] CHECK  (([ReviewDate]>='2007-01-01' AND [ReviewDate]<='2007-12-31'))
GO
ALTER TABLE [dbo].[Test2007] CHECK CONSTRAINT [CK_Test2007]
GO
CREATE TABLE [dbo].[Test2008](
[ProductReviewID] [int] IDENTITY(1??1) NOT NULL??
[ReviewDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Test2008]  WITH CHECK ADD  CONSTRAINT [CK_Test2008] CHECK  (([ReviewDate]>='2008-01-01' AND [ProductReviewID]<='2008-12-31'))
GO
ALTER TABLE [dbo].[Test2008] CHECK CONSTRAINT [CK_Test2008]
GO
INSERT INTO [Test2008] values('2008-05-06')
INSERT INTO [Test2007] VALUES('2007-05-06')
CREATE VIEW testPartitionView
AS
SELECT * FROM Test2007
UNION
SELECT * FROM Test2008
SELECT * FROM testPartitionView
WHERE [ReviewDate]='2007-01-01'
SELECT * FROM testPartitionView
WHERE [ReviewDate]='2008-01-01'
SELECT * FROM testPartitionView
WHERE [ReviewDate]='2010-01-01'