我是根据选择不同的时间段,从Table2中选择数据,生成Table1。要是存在Table1则删除,重新生成。要是没有Table1则根据选择的时间段从Table2中读取数据生成Table1,注意啊,选择不同的时间段,从Table2中读取的数据就不一样啊,每一次选择时间都要更新Table1
CREATE PROCEDURE swxxcl2
(
@time1 varchar (10),
@time2 varchar(10)
)
AS
if exists(select * from sysobjects where name='Table1')
drop table Table1
select Dw_Name,sum(Sw_Person_No) AS Sw_Person_Sum ,sum(Sw_grfk) AS Sw_grfk_Sum ,sum(Sw_jtfk) AS Sw_jtfk_Sum ,
isnull(sum(Sw_grfk),0)+isnull(sum(Sw_jtfk),0) AS Dw__sum into Table1
from Table2 where Sw_Time between @time1 and @time2
group by Dw_Name
GO
解决方案 »
- NET C# 控件怎么去掉 ViewState
- ckeditor中,在文本域中禁用双引号
- html引用js文件可以。但在asp.net 里面引用就出问题了
- 求助:如何将SQL数据库的内容导出到EXCEL表格?
- 这个问题让人头疼的受不了,那位大哥帮小弟一把.
- asp:button 如何响应客户的js脚本??谢谢
- 关心ASP.NET2.0的一个问题!
- 怎样统计一个目录的大小啊?
- 项目感受
- 谁能简单的(用代码示例)介绍一下自定义控件的关键步骤。
- 急问:Button的Click事件与RadioButton的CheckedChanged事件有什么区别?
- 问个小问题:从A页面传递到B页面的值,为了保证B页面在刷新的时候不丢失,你们一般是用什么来保存的?
@time2 varchar(10)-- 除了这两个要改一下类型以外,没看出其它的问题~~~@time1 datetime,
@time2 datetime
(
@time1 datetime,
@time2 datetime
)
AS
if exists(select * from sysobjects where name='Table1')
drop table Table1 select
Dw_Name,
sum(Sw_Person_No) AS Sw_Person_Sum,
sum(Sw_grfk) AS Sw_grfk_Sum,
sum(Sw_jtfk) AS Sw_jtfk_Sum,
isnull(sum(Sw_grfk),0)+isnull(sum(Sw_jtfk),0) AS Dw__sum
into Table1
from Table2
where Sw_Time between @time1 and @time2
group by Dw_Name
GO
(
@time1 varchar (10),
@time2 varchar(10)
)
AS
if exists(select * from sysobjects where name='Table1' and type='u')
begin
drop table Table1
end
select Dw_Name,sum(Sw_Person_No) AS Sw_Person_Sum ,sum(Sw_grfk) AS Sw_grfk_Sum ,sum(Sw_jtfk) AS Sw_jtfk_Sum ,
isnull(sum(Sw_grfk),0)+isnull(sum(Sw_jtfk),0) AS Dw__sum into Table1
from Table2 where Sw_Time between @time1 and @time2
group by Dw_Name
GO
则参数数日期型
如果参数类型不变,可以使下面方法
convert(char(10), Sw_Time ,120) >=convert(char(10), @time1, 120) and convert(char(10), Sw_Time ,120) <=convert(char(10), @time2, 120)