标题:存储过程报错(已修改)
取消只看楼主
pchelp2008
Rank: 1
等 级:新手上路
威 望:1
帖 子:177
专家分:0
注 册:2006-8-2
 问题点数:0 回复次数:1 
存储过程报错(已修改)


CREATE PROCEDURE SearchCatalog
(
@PageNumber TINYINT,/*当前第几页*/
@ProductsPerPage TINYINT, /*显示多页条信息*/
@HowManyResults SMALLINT OUTPUT, /*总信息数*/
@ClassId TINYINT,/*类的ID*/
@endstr nvarchar(100)
AS
declare
@SQL Varchar(4000),
@SQL1 Varchar(4000)
DECLARE
@MypdView TABLE
(RowNumber SMALLINT IDENTITY (1,1) NOT NULL,
id int,
showname VARCHAR(1000),
price VARCHAR(100),
keywords varchar(500),
content varchar(1000),
hits varchar(10),
corpname varchar(500),
Vip bit
)


set @SQL='INSERT INTO @MypdView
select M.ID,M.ShowName,M.PriceTerms,M.Keywords,M.Content,M.hits,S.Corp_name,vip=1 from dbo.Sys_Corporation as S,dbo.MYPD_Information as M where M.UserId=S.id and vip=1 '+@endstr+' ORDER BY M.id DESC'
exec(@SQL)
set @SQL1='INSERT INTO @MypdView
select M.ID,M.ShowName,M.PriceTerms,M.Keywords,M.Content,M.hits,S.Corp_name,vip=0 from dbo.Sys_Corporation as S,dbo.MYPD_Information as M where M.UserId=S.id and vip<>1 '+@endstr+' ORDER BY M.id DESC'
exec(@SQL1)

SELECT @HowManyResults = COUNT(*)

FROM @MypdView

SELECT id,showname,price,keywords,content,hits,corpname,vip

FROM @MypdView

WHERE

RowNumber BETWEEN (@PageNumber-1) * @ProductsPerPage + 1

AND @PageNumber * @ProductsPerPage ORDER BY RowNumber DESC
GO

错误:
服务器: 消息 156,级别 15,状态 1,过程 SearchCatalog,行 8
在关键字 'AS' 附近有语法错误。

[此贴子已经被作者于2007-3-30 15:30:58编辑过]

搜索更多相关主题的帖子: 信息 content price 
2007-03-30 15:08
pchelp2008
Rank: 1
等 级:新手上路
威 望:1
帖 子:177
专家分:0
注 册:2006-8-2
得分:0 
那是谁写的!呀,,是我写的

天才=勤奋+汗水ggggggggggggggggg
2007-03-30 15:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-128109-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.169849 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved