您的位置:程序门 -> ms-sql server -> 应用实例



帮我解决一下了,很急~~~~~~!!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


帮我解决一下了,很急~~~~~~!![已结贴,结贴人:cibgbvb]
发表于:2007-04-13 11:13:52 楼主
create   proc   preparforbusiness--营业数据预备
    @onshowdate   varcher(20)
as
begin   tran
    update   onshowplan   set   onshownop=onshownop-4   where   onshownop> 3
    insert   into   historyrecords(filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,boxofficeintake)
        values   (select   filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,intake   from   saletodayinf   )
    delete   saletodayinf
    insert   into   saletodayinf   values   (select   *   from   saletomorrowinf)
    update   saletodayinf   set   onshownop=onshownop-4
    delete   saletomorrowinf
    insert   into   saletomorrowinf   values   (select   *   from   salethirddayinf)
    update   saletomorrowinf   set   onshownop=onshownop-4
    delete   salethirddayinf
    insert   into   salethirddayinf     values(select   onshowplan.onshowindex,onshowplan.theaterid,onshowplan.cinemaid,onshowplan.filmid,onshowplan.onshownop,cinemainf.singleseat,
                                                                            cinemainf.boxes   from   onshowplan,cinemainf
                  where   onshowplan.onshownop=8   or   onshowplan.onshownop=9   or   onshowplan.onshownop=10   or   onshowplan.onshownop=11   and   onshowplan.cinemaid=cinemainf.cinemaid)
go


服务器:   消息   156,级别   15,状态   1,过程   preparforbusiness,行   7
在关键字   'select '   附近有语法错误。
服务器:   消息   170,级别   15,状态   1,过程   preparforbusiness,行   7
第   7   行:   ') '   附近有语法错误。
服务器:   消息   156,级别   15,状态   1,过程   preparforbusiness,行   9
在关键字   'select '   附近有语法错误。
服务器:   消息   170,级别   15,状态   1,过程   preparforbusiness,行   9
第   9   行:   ') '   附近有语法错误。
服务器:   消息   156,级别   15,状态   1,过程   preparforbusiness,行   12
在关键字   'select '   附近有语法错误。
服务器:   消息   170,级别   15,状态   1,过程   preparforbusiness,行   12
第   12   行:   ') '   附近有语法错误。
服务器:   消息   156,级别   15,状态   1,过程   preparforbusiness,行   15
在关键字   'select '   附近有语法错误。
服务器:   消息   170,级别   15,状态   1,过程   preparforbusiness,行   17
第   17   行:   ') '   附近有语法错误。
发表于:2007-04-13 11:17:351楼 得分:5
insert   into   historyrecords(filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,boxofficeintake)
        values   (select   filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,intake   from   saletodayinf   )
改为
insert   into   historyrecords(filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,boxofficeintake)
        select   filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,intake   from   saletodayinf  

其他的错误相同
发表于:2007-04-13 11:17:592楼 得分:5
create   proc   preparforbusiness--营业数据预备
    @onshowdate   varcher(20)
as
begin   tran
    update   onshowplan   set   onshownop=onshownop-4   where   onshownop> 3
   
    insert   into   historyrecords(filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,boxofficeintake)
    select   filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,intake   from   saletodayinf
   
    delete   saletodayinf
   
    insert   into   saletodayinf   select   *   from   saletomorrowinf
   
    update   saletodayinf   set   onshownop=onshownop-4
   
    delete   saletomorrowinf
   
    insert   into   saletomorrowinf   select   *   from   salethirddayinf
   
    update   saletomorrowinf   set   onshownop=onshownop-4
   
    delete   salethirddayinf
   
    insert   into   salethirddayinf  
    select  
            onshowplan.onshowindex,onshowplan.theaterid,onshowplan.cinemaid,
            onshowplan.filmid,onshowplan.onshownop,cinemainf.singleseat,
            cinemainf.boxes  
    from  
            onshowplan,cinemainf
    where  
            onshowplan.onshownop=8   or   onshowplan.onshownop=9   or   onshowplan.onshownop=10  
            or  
            onshowplan.onshownop=11   and   onshowplan.cinemaid=cinemainf.cinemaid
go
发表于:2007-04-13 11:22:433楼 得分:2
create   proc   preparforbusiness--营业数据预备
    @onshowdate   varcher(20)
as
begin   tran
    update   onshowplan   set   onshownop=onshownop-4   where   onshownop> 3
    insert   into   historyrecords(filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,boxofficeintake)
      select   filmid,cinemaid,theaterid,onshownop,singletickets,boxtickets,intake   from   saletodayinf  
    delete   saletodayinf
    insert   into   saletodayinf   select   *   from   saletomorrowinf
    update   saletodayinf   set   onshownop=onshownop-4
    delete   saletomorrowinf
    insert   into   saletomorrowinf   select   *   from   salethirddayinf
    update   saletomorrowinf   set   onshownop=onshownop-4
    delete   salethirddayinf
    insert   into   salethirddayinf     select   onshowplan.onshowindex,onshowplan.theaterid,onshowplan.cinemaid,onshowplan.filmid,onshowplan.onshownop,cinemainf.singleseat,
                                                                            cinemainf.boxes   from   onshowplan,cinemainf
                  where   onshowplan.onshownop=8   or   onshowplan.onshownop=9   or   onshowplan.onshownop=10   or   onshowplan.onshownop=11   and   onshowplan.cinemaid=cinemainf.cinemaid
go
发表于:2007-04-13 11:24:424楼 得分:3
你的insert的语法不对.

----例子----

insert   into   tablename1(column1,column2)   select   column1,column2   from   tablename2

---这两句话不要加values


快速检索

最新资讯
热门点击