declare  @date  datetime
declare  @state  varchar(20)
declare  @sumtotal int
declare  @sumprice  varchar(20)
  declare  diandianfei_Cursor  cursor for select o.dOrderDate  from orders o
  open  diandianfei_Cursor
FETCH NEXT FROM  diandianfei_Cursor  into @date
WHILE @@FETCH_STATUS = 0
  begin
    PRINT '时间: ' + CONVERT(varchar(10),@date,120)
   select   distinct    @sumtotal=sum(siQty)   from  orderdetail,orders 
where orders.corderno=orderdetail.corderno and orders.dOrderDate=@date
 if(@sumtotal>170)
   set  @state ='high sales'
 else  set @state='low sales'
print  @state
select @sumprice=cast(sum(mTotalCost) as varchar) from  orders   --*改 错误
print @sumprice
FETCH NEXT FROM  diandianfei_Cursor  into @date
end
close  diandianfei_Cursor
DEALLOCATE diandianfei_Cursor