谁给我介绍一下sql中的cte啊

[复制链接]
查看11 | 回复1 | 2010-7-16 10:18:24 | 显示全部楼层 |阅读模式
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
(
select rn=right('0000000'+rtrim(@n+ROW_NUMBER()over(order by getdate())),8),value
from inserted
)
insert kof
select * from cte
end
如上,这个cte是什么东西啊,好像没看到表里面有定义cte。。。

回复

使用道具 举报

千问 | 2010-7-16 10:18:24 | 显示全部楼层
http://hi.baidu.com/a_magic/blog/item/1c7e48946efe0717d21b70ec.html共同学习.
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行