| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 525 人关注过本帖
标题:存储过程报错(已修改)
只看楼主 加入收藏
pchelp2008
Rank: 1
等 级:新手上路
威 望:1
帖 子:177
专家分:0
注 册:2006-8-2
收藏
 问题点数:0 回复次数:3 
存储过程报错(已修改)


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
棉花糖ONE
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:2987
专家分:0
注 册:2006-7-13
收藏
得分:0 
这存储过程不是你写的吧

26403021 sql群 博客 blog./user15/81152/index.shtml
2007-03-30 15:32
pchelp2008
Rank: 1
等 级:新手上路
威 望:1
帖 子:177
专家分:0
注 册:2006-8-2
收藏
得分:0 
那是谁写的!呀,,是我写的

天才=勤奋+汗水ggggggggggggggggg
2007-03-30 15:36
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
收藏
得分:0 
以下是引用pchelp2008在2007-3-30 15:08:52的发言:


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-03-30 16:50
快速回复:存储过程报错(已修改)
数据加载中...
 
   



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

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