@CaseWeek int=(datepart(weekday,getdate())),
老是报错说: '(' 附近有语法错误 ,必须声明变量 '@CaseWeek'。
问题补充:
这是整个过程代码:
if exists(select * from sysobjects where xtype = 'P' and name ='HCase_Insert')
drop procedure HCase_Insert
go
Create procedure HCase_Insert
(
@PKID int output,
@InputDate datetime=getdate,
declare @CaseWeek int,
set @CaseWeek=(datepart(weekday,getdate())),
@CaseDate datetime ,
@Adr_numb nvarchar(20),
@Case_type int ,
@Case_weather int,
@Case_carType int,
@Case_status int,
@Road_type int,
@Road_status int,
@Road_form int,
@Road_band int,
@Summ_parties nvarchar(20),
@Summ_units nvarchar(50),
@Summ_carID nvarchar(20),
@Casualty_death int,
@Casualty_fleshwound int,
@Casualty_GBH int,
@Lose_road money, --路面损失
@Lose_safty money, --交通安全措施损失
@Lose_protection money, --安防损失
@Lose_virescence money, --绿化损失
@Lose_scutcheon money, --标牌损失
@Lose_chargesys money, --联网收费系统损失
@Lose_lights money, --照明设备损失
@Lose_total money,
--合计 计算 可有计算机执行
@Handle_UnitID int
)
As
Insert into HCase(InputDate,CaseWeek,CaseDate,Adr_numb,Case_type,Case_weather,Case_carType,
Case_status,Road_type,Road_status,Road_form,Road_band,Summ_parties,Summ_units,
Summ_carID,Casualty_death,Casualty_fleshwound,Casualty_GBH,Lose_road,Lose_safty,
Lose_protection,Lose_virescence,Lose_scutcheon,Lose_chargesys,Lose_lights,Lose_total)
values(@InputDate,@CaseWeek,@CaseDate,@Adr_numb,@Case_type,@Case_weather,@Case_carType,
@Case_status,@Road_type,@Road_status,@Road_form,@Road_band,@Summ_parties,@Summ_units,
@Summ_carID,@Casualty_death,@Casualty_fleshwound,@Casualty_GBH,@Lose_road,@Lose_safty,
@Lose_protection,@Lose_virescence,@Lose_scutcheon,@Lose_chargesys,@Lose_lights,@Lose_total)
go