读书人

帮小弟我解决一下了很急

发布时间: 2012-01-26 19:40:46 作者: rapoo

帮我解决一下了,很急~~~~~~!!
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 行: ') ' 附近有语法错误。

[解决办法]
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

其他的错误相同
[解决办法]
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
[解决办法]
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
[解决办法]
你的insert的语法不对.

----例子----

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

---这两句话不要加values

读书人网 >SQL Server

热点推荐