The begin
Select @ VIS=VIS,
@ Code=Code,
@ ATime=ATime,
@ Result=Result,
@ CSTime=CSTime,
@ Compressor=Compressor,
@ Highvoltage=Highvoltage,
@ Reess=Reess,
@ RightCharger=RightCharger,
@ LeftCharger=LeftCharger,
@ GGResistance=GGResistance,
@ NGResistance=NGResistance,
@ ChargingPort=ChargingPort
The from inserted;
If the exists (select * from T_R_ZCResult where VIS=@ VIS)
The begin
- change
The update T_R_ZCResult set
ZCSC_CODE=@ Code,
ZCSC_ATIME=@ ATime,
ZCSC_RESULT=@ Result,
ZCSC_CSTime=@ CSTime,
ZCSC_Compressor=@ Compressor,
ZCSC_Highvoltage=@ Highvoltage,
ZCSC_Reess=@ Reess,
ZCSC_RightCharger=@ RightCharger,
ZCSC_LeftCharger=@ LeftCharger,
ZCSC_GGResistance=@ GGResistance,
ZCSC_NGResistance=@ NGResistance,
ZCSC_ChargingPort=@ ChargingPort
Where VIS=@ VIS
End
The else
The begin
Add
-Insert into T_R_ZCResult (VIS, ZCSC_CODE ZCSC_ATIME, ZCSC_RESULT, ZCSC_CSTime, ZCSC_Compressor, ZCSC_Highvoltage, ZCSC_Reess, ZCSC_RightCharger, ZCSC_LeftCharger, ZCSC_GGResistance, ZCSC_NGResistance, ZCSC_ChargingPort)
Values (@ VIS, @ Code, @ ATime, @ Result, @ CSTime, @ Compressor, @ Highvoltage and @ Reess, @ RightCharger, @ LeftCharger, @ GGResistance, @ NGResistance, @ ChargingPort)
End
End
Above is SQL SERVER statement how to MYSQL nasty is mainly the statement how to change the MYSQL useless select * from inserted this
CodePudding user response:
IF the EXISTS (select 1 from T_R_ZCResult where VIS=@ VIS) THENThe update T_R_ZCResult set
ZCSC_CODE=@ Code,
ZCSC_ATIME=@ ATime,
ZCSC_RESULT=@ Result,
ZCSC_CSTime=@ CSTime,
ZCSC_Compressor=@ Compressor,
ZCSC_Highvoltage=@ Highvoltage,
ZCSC_Reess=@ Reess,
ZCSC_RightCharger=@ RightCharger,
ZCSC_LeftCharger=@ LeftCharger,
ZCSC_GGResistance=@ GGResistance,
ZCSC_NGResistance=@ NGResistance,
ZCSC_ChargingPort=@ ChargingPort
Where VIS=@ VIS;
The else
Insert into T_R_ZCResult (VIS, ZCSC_CODE ZCSC_ATIME, ZCSC_RESULT, ZCSC_CSTime, ZCSC_Compressor, ZCSC_Highvoltage, ZCSC_Reess, ZCSC_RightCharger, ZCSC_LeftCharger, ZCSC_GGResistance, ZCSC_NGResistance, ZCSC_ChargingPort)
Values (@ VIS, @ Code, @ ATime, @ Result, @ CSTime, @ Compressor, @ Highvoltage and @ Reess, @ RightCharger, @ LeftCharger, @ GGResistance, @ NGResistance, @ ChargingPort);
END IF;
CodePudding user response:
But you didn't write a great god is the most critical part of the above theIf the exists (select * from inserted) and not the exists (select * from does) - add
The begin
Select @ VIS=VIS,
@ Code=Code,
@ ATime=ATime,
@ Result=Result,
@ CSTime=CSTime,
@ Compressor=Compressor,
@ Highvoltage=Highvoltage,
@ Reess=Reess,
@ RightCharger=RightCharger,
@ LeftCharger=LeftCharger,
@ GGResistance=GGResistance,
@ NGResistance=NGResistance,
@ ChargingPort=ChargingPort
The from inserted;
Because there is no inserted MYSQL does this query method so special meng, a great god is here to help me appreciate small woman
CodePudding user response: