求显示留言代码
USE [guestbook]GO/****** Object: StoredProcedure [dbo].[selectmessage] Script Date: 08/27/2012 17:40:09 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER proc [dbo].[selectmessage] @pageSize int, @pageIndex intasdeclare @sql nvarchar(200)if(@pageIndex<2)beginset @sql='select top '+convert(varchar(10),@pageSize)+' * from gbook'endelsebeginset @sql='select top '+convert(varchar(10),@pageSize)+' * from gbook whereid>(select max(id) from ( select top '+convert(varchar(10),@pageSize*(@pageIndex-1))+' id from gbook order by id) a)order by id'endexec sp_executesql @sql