/*存储过程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是一个在线投票系统的数据库中创建存储过程

解决方案 »

  1.   

    错误如下:
    服务器: 消息 137,级别 15,状态 1,过程 Pr_GetVotes,行 16
    必须声明变量 '@VoteID'。
    服务器: 消息 137,级别 15,状态 1,过程 Pr_GetVotes,行 26
    必须声明变量 '@Item'。
    服务器: 消息 156,级别 15,状态 1,过程 Pr_GetVotes,行 30
    在关键字 'proc' 附近有语法错误。
    服务器: 消息 137,级别 15,状态 1,过程 Pr_GetVotes,行 37
    必须声明变量 '@VoteID'。
    服务器: 消息 137,级别 15,状态 1,过程 Pr_GetVotes,行 46
    必须声明变量 '@VoteID'。
      

  2.   

    /*存储过程Pr_GetVotes */
    create proc Pr_GetVotes
    ASselect *
       from Votes
       order by VoteIDgo
    /* 存储过程Pr_GetSingleVote*/
    create proc Pr_GetSingleVote
    (   @VoteID int)
    AS
    select Votes.*
       from Votes
       where VoteID = @VoteIDgo
    /*存储过程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 = @VoteIDgo/*存储过程Pr_DeleteVote*/
    create proc Pr_DeleteVote
    (
       @VoteID int
    )
    AS
    delete Votes
    where VoteID = @VoteID