这么写存储过程会不会很慢,,,,??
CREATE PROCEDURE UP_Get_Channel1AS
declare @Provisional table
(
row smallint not null identity(1,1),
title VarChar(50),
content VarChar(50),
imageurl VarChar(50),
datetime DateTime,
url VarChar(50)
)
insert into @Provisional (title,content,imageurl,datetime,url)
select top 2 title,content,imageurl,datetime,url from ac_childclass where pid=1 and images=1 order by datetime desc
insert into @Provisional (title,content,imageurl,datetime,url)
select top 6 title,content,imageurl,datetime,url from ac_childclass where pid=1 and images=0 order by datetime desc
insert into @Provisional (title,content,imageurl,datetime,url)
select top 2 title,content,imageurl,datetime,url from ac_childclass where pid=2 and images=1 order by datetime desc
insert into @Provisional (title,content,imageurl,datetime,url)
select top 2 title,content,imageurl,datetime,url from ac_childclass where pid=2 and images=0 order by datetime desc
这么搞下去.会不会很慢??(一直加到6)弄个循环会不会好点?已经建了组合索引 --------------------编程问答-------------------- 效率应该是差不多的,如果想要相率好点,就想办法减少“insert”语句的出现次数。数据库在执行除SELECT以外的操作都会锁表。 --------------------编程问答-------------------- union all --------------------编程问答-------------------- 应该差不多
补充:.NET技术 , ASP.NET