日期:2014-05-17 浏览次数:20783 次
USE [Pica2.0]
GO
/****** Object: StoredProcedure [dbo].[GetSitePV] Script Date: 05/07/2013 14:43:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[GetSitePV]
-- Add the parameters for the stored procedure here
@NodeId int
AS
begin
Create Table #Temp1(NewsId int, NodeId int, Title nvarchar(200), SubTitle varchar(200), Author nvarchar(50), Editor nvarchar(50), Sources nvarchar(50), Photographer nvarchar(50),
BriefContent nvarchar(1000), Content text, State nvarchar(10), Keyword nvarchar(200),
Deliveries nvarchar(200), CreateTime date, PublishTime date, NewsTop bit, NewsOrder int, NewsSecurity int)
insert into #temp1
exec [LatestNews1]
@nodeId=@NodeId,
@outCount = 999999
select * from PageView where PageView.NewsId in (select #Temp1.newsid from #Temp1)
end
USE [Pica2.0]
GO
/****** Object: StoredProcedure [dbo].[LatestNews1] Script Date: 05/07/2013 17:11:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,标题相同数据>
-- =============================================
ALTER PROCEDURE [dbo].[LatestNews1]
@nodeId int,
@outCount int
AS
BEGIN
SET NOCOUNT ON;
create table #temp(nodeid int, url nvarchar(2000))
insert into #temp select @nodeId, dbo.getnodeurl(@nodeId)
--统计以缓存表为父级的子集node条数
declare @two int
select @two=COUNT(nodeid) from Nodes where NodeID not in (select nodeid from #temp) and FatherId in (select NodeID from #temp)
while(@two <> 0)
begin
insert into #temp select nodeid,dbo.getnodeurl(NodeID) from nodes where NodeID not in (select nodeid from #temp) and FatherId in (select NodeID from #temp)
select @two=COUNT(nodeid) from Nodes where NodeID not in (select nodeid from #temp) and FatherId in (select NodeID from #temp)
end
declare @sql nvarchar(2000)
--select * from #temp
set @sql = 'select top ' + Convert(nvarcha