SQL sever 特性

  • 批量插入

sql sever 没有常规的批量插入,可以通过下面的语句实现批量插入


INSERT INTO Chart(createTime, kpi, field, value)
select convert(datetime,'2015-02-01 12:00:00',20), 'disk', 'disk', 20 union all
select convert(datetime,'2015-02-01 12:15:00',20), 'disk', 'disk', 30 union all
select convert(datetime,'2015-02-01 12:20:00',20), 'disk', 'disk', 25 union all
select convert(datetime,'2015-02-01 12:30:00',20), 'disk', 'disk', 25 union all
select convert(datetime,'2015-02-01 12:35:00',20), 'disk', 'disk', 25 union all
select convert(datetime,'2015-02-01 12:40:00',20), 'disk', 'disk', 25 union all
select convert(datetime,'2015-02-01 12:00:00',20), 'disk', 'disk-all', 20 union all
select convert(datetime,'2015-02-01 12:20:00',20), 'disk', 'disk-all', 30 union all
select convert(datetime,'2015-02-01 12:25:00',20), 'disk', 'disk-all', 25 union all
select convert(datetime,'2015-02-01 12:30:00',20), 'disk', 'disk-all', 25 union all
select convert(datetime,'2015-02-01 12:35:00',20), 'disk', 'disk-all', 25 union all
select convert(datetime,'2015-02-01 12:40:00',20), 'disk', 'disk-all', 25 union all
select convert(datetime,'2015-02-01 12:40:00',20), 'cpu', 'cpu-all', 25 union all
select convert(datetime,'2015-02-01 12:40:00',20), 'cpu', 'cpu', 25 
  • 创建视图 view 不能有 order by

你可能感兴趣的:(SQL sever 特性)