谁帮我解释一下这段sql

[复制链接]
查看11 | 回复1 | 2010-7-16 10:25:30 | 显示全部楼层 |阅读模式
create trigger trIns on kof
instead ofinsert
as
begin
declare @n int
set @n=(select cast(isnull(MAX(id),0) as int) from kof);
with cte as//主要是with里面的搞不懂。以及with
(
select rn=right('0000000'+rtrim(@n+ROW_NUMBER()over(order by getdate())),8),value
from inserted
)
insert kof
select * from cte
end

回复

使用道具 举报

千问 | 2010-7-16 10:25:30 | 显示全部楼层
Precipitation是字符型字段,通过cast转换为整形字段后,用sum函数汇总取总和以上,希望对你有所帮助!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行