create table order1 (时间 varchar(30) primary key not NULL ,阻值 numeric(5,3) , 功率 numeric(5,3))
INSERT INTO order1(时间,阻值,功率 )VALUES (convert(varchar,getdate(),21),123,333)
本人想在该表的时间字段上加一个聚集索引,以年月日小时为单位,怎么写?
INSERT INTO order1(时间,阻值,功率 )VALUES (convert(varchar,getdate(),21),123,333)
本人想在该表的时间字段上加一个聚集索引,以年月日小时为单位,怎么写?
时间 varchar(30) not NULL ,
阻值 numeric(5,3) ,
功率 numeric(5,3),
PRIMARY KEY CLUSTERED
(
[时间]
) ON [PRIMARY] )
alter table order1 add index on order1(时间)
VALUES (convert(varchar,getdate(),21),
123,333) --这两个数太大了
时间字段格式是:xxxx年xx月xx日 xx:xx:xx.xxx
带毫秒的
本人想在该表的时间字段上加一个聚集索引,以年月日小时为单位,怎么写?
如果要分秒的话
只能通过个计算列来实现