http://topic.csdn.net/u/20071017/17/88e7b608-24f2-43ee-9879-f46450f777fd.html
create TABLE [dbo].[Tt](
[id] [int] IDENTITY(1,1) NOT NULL,
[old] [int] NULL,
[date] [datetime] NULL,
CONSTRAINT [IX_T] UNIQUE NONCLUSTERED
(
[old] ASC,
CONVERT(CHAR(10),[date],120) ASC
)
)
create TABLE [dbo].[Tt](
[id] [int] IDENTITY(1,1) NOT NULL,
[old] [int] NULL,
[date] [datetime] NULL,
CONSTRAINT [IX_Tt] UNIQUE NONCLUSTERED
(
[old] ASC,
[date] ASC
)
)
约束只能是整个字段,不能是字段的一部份(即字符串...... )
现在考虑能不能加个字段,默认值为另外一个字段的部分字符。