高分题?菜鸟题!
1. select * from (select....) as tmpTbl where tmpTbl.ID in (select....) <其中select....返回的是同一个表>
与 insert into #tbl (select....); select * from (#tbl) where ID in (#tbl)
哪个效率更高??前者是否会执行两次相同的(select....)
2. 如何在存储过程的语句中使用变量?
create proc test
@i int
as
select * from tbl where ID= @i --写法对不对???
GO
3.表变量和临时表到底有什么区别?有什么限制?哪个效率高?
declare @tbl table(tid int)
create #tbl (tid int)
以上两个东东分别用在什么地方?不能用在什么地方?哪个效率高?