日期:2014-05-19  浏览次数:20725 次

用SQL创建存储过程时出现错误?那位高手帮我看下
/*存储过程Pr_GetVotes   */
create   proc   Pr_GetVotes
AS
select   *
      from   Votes
      order   by   VoteID

/*   存储过程Pr_GetSingleVote*/
create   proc   Pr_GetSingleVote
(
      @VoteID   int
)
AS
select   Votes.*
      from   Votes
      where   VoteID   =   @VoteID

/*存储过程Pr_AddVote*/
create   proc   Pr_AddVote
(
      @Item   varchar(100)
)
AS
insert   into
      Votes(Item,ItemCount)
      Values(@Item,0)
      return   @@Identity

/*存储过程Pr_UpdateVote*/
create   proc   Pr_UpdateVote
(
      @VoteID   int
)
AS
Update   Votes
      set   VoteCount   =   VoteCount   +   1
      where   VoteID   =   @VoteID

/*存储过程Pr_DeleteVote*/
create   proc   Pr_DeleteVote
(
      @VoteID   =   int
)
AS
delete   Votes
where   VoteID   =   @VoteID


是一个在线投票系统的数据库中创建存储过程

------解决方案--------------------
/*存储过程Pr_GetVotes */
create proc Pr_GetVotes
AS

select *
from Votes
order by VoteID

go
/* 存储过程Pr_GetSingleVote*/
create proc Pr_GetSingleVote
( @VoteID int)
AS
select Votes.*
from Votes
where VoteID = @VoteID

go
/*存储过程Pr_AddVote*/
create proc Pr_AddVote
(
@Item varchar(100)
)
AS
insert into
Votes(Item,ItemCount)
Values(@Item,0)
return @@Identity
go

/*存储过程Pr_UpdateVote*/
create proc Pr_UpdateVote
(
@VoteID int
)
AS
Update Votes
set VoteCount = VoteCount + 1
where VoteID = @VoteID

go

/*存储过程Pr_DeleteVote*/
create proc Pr_DeleteVote
(
@VoteID int
)
AS
delete Votes
where VoteID = @VoteID