必须声明标量变量&语法不正确

时间:2017-06-26 13:13:37

标签: sql-server

如何解决这个问题 它是工作,但我添加一些新的行,并更改一些然后出现此错误 它是@Old_CH_SWORD_ID,我将其更改为@Old_CH_HA_ID,类似于代码,所有代码都改变了所有代码 这就是声明

 Declare @CreaterName Varchar(60) = 'iLegend' , -- Creater Name
 @WeaponSlot Int = 13 , -- char inventory weapon slot
 @ReqOptLevel Int = 7    , -- Change old item requiared plus for upgrade.
 @NewOptLevel Int = 0    , -- Change new item plus after upgrade
 @Old_CH_HA_ID Int  = 4265    , @New_CH_HA_ID Int  = 39022  ,    --@New 
 Chinese Sword
 @Old_CH_SA_ID Int = 4337    , @New_CH_SA_ID Int = 39025  ,    --@Chinese 
 Glaive
 @Old_CH_BA_ID Int  = 4373    , @New_CH_BA_ID Int  = 39028  ,    --@Chinese 
 Blade
 @Old_CH_LA_ID Int    = 4409    , @New_CH_LA_ID Int    = 39031  ,    --
 @Chinese Bow
 @Old_CH_AA_ID Int = 4445    , @New_CH_AA_ID Int    = 39034   ,    --
 @Chinese Shield
 @Old_EU_FA_ID Int = 4481    , @New_EU_FA_ID Int = 39037  ,    --@European 
 Dagger
 Update [SRO_VT_SHARD].[dbo].[_Items] Set RefItemID = @New_CH_HA_ID  , 
 OptLevel = @NewOptLevel , CreaterName = @CreaterName Where ID64 = (Select           
 ItemID From [SRO_VT_SHARD].[dbo].[_Inventory] Where CharID = @CharID and 
 Slot =      
 @WeaponSlot and ItemID> 0) and RefItemID = @Old_CH_HA_ID  and (OptLevel >= 
 @ReqOptLevel)    --@Sword
 Update [SRO_VT_SHARD].[dbo].[_Items] Set RefItemID = @New_CH_BA_ID  , 
 OptLevel = @NewOptLevel , CreaterName = @CreaterName Where ID64 = (Select 
 ItemID From [SRO_VT_SHARD].[dbo].[_Inventory] Where CharID = @CharID and 
 Slot = @WeaponSlot and ItemID> 0) and RefItemID = @Old_CH_BA_ID  and 
 (OptLevel >= @ReqOptLevel)    --@Blade
 Update [SRO_VT_SHARD].[dbo].[_Items] Set RefItemID = @New_CH_SA_ID , 
 OptLevel = @NewOptLevel , CreaterName = @CreaterName Where ID64 = (Select 
 ItemID From [SRO_VT_SHARD].[dbo].[_Inventory] Where CharID = @CharID and 
 Slot = @WeaponSlot and ItemID> 0) and RefItemID = @Old_CH_SA_ID and 
 (OptLevel >= @ReqOptLevel)    --@T-Blade
 Update [SRO_VT_SHARD].[dbo].[_Items] Set RefItemID = @New_CH_LA_ID    , 
 OptLevel = @NewOptLevel , CreaterName = @CreaterName Where ID64 = (Select 
 ItemID From [SRO_VT_SHARD].[dbo].[_Inventory] Where CharID = @CharID and 
 Slot = 
 @WeaponSlot and ItemID> 0) and RefItemID = @Old_CH_LA_ID    and (OptLevel 
 >= 
 @ReqOptLevel)    --@Bow
 Update [SRO_VT_SHARD].[dbo].[_Items] Set RefItemID = @New_CH_AA_ID , 
 OptLevel = @NewOptLevel , CreaterName = @CreaterName Where ID64 = (Select 
 ItemID 
 From [SRO_VT_SHARD].[dbo].[_Inventory] Where CharID = @CharID and Slot = 
 @WeaponSlot and ItemID> 0) and RefItemID = @Old_CH_AA_ID and (OptLevel >= 
 @ReqOptLevel)    --@Shield
 Update [SRO_VT_SHARD].[dbo].[_Items] Set RefItemID = @New_EU_FA_ID , 
 OptLevel = @NewOptLevel , CreaterName = @CreaterName Where ID64 = (Select 
 ItemID 
 From [SRO_VT_SHARD].[dbo].[_Inventory] Where CharID = @CharID and Slot = 
 @WeaponSlot and ItemID> 0) and RefItemID = @Old_EU_FA_ID and (OptLevel >= 
 @ReqOptLevel)    --@Dagger

此     消息102,级别15,状态1,过程_UpgradeSystemSETSUN,第24行     ' @ Old_CH_HA_ID'附近的语法不正确。  从这里开始

来自代码的这种排序

Msg 102, Level 15, State 1, Procedure _UpgradeSystemSETSUN, Line 24
Incorrect syntax near '@Old_CH_HA_ID'.
Msg 137, Level 15, State 2, Procedure _UpgradeSystemSETSUN, Line 126
Must declare the scalar variable "@New_CH_HA_ID".
Msg 137, Level 15, State 2, Procedure _UpgradeSystemSETSUN, Line 126
Must declare the scalar variable "@WeaponSlot".
Msg 137, Level 15, State 2, Procedure _UpgradeSystemSETSUN, Line 127
Must declare the scalar variable "@New_CH_BA_ID".
Msg 137, Level 15, State 2, Procedure _UpgradeSystemSETSUN, Line 127
Must declare the scalar variable "@WeaponSlot".
Msg 137, Level 15, State 2, Procedure _UpgradeSystemSETSUN, Line 128
...... more

0 个答案:

没有答案