标签:
USE [AutoRent] GO /****** Object: StoredProcedure [dbo].[Usp_expense_alert] Script Date: 09/16/2015 16:39:05 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROC [dbo].[Usp_expense_alert] ( @username VARCHAR(100) , @TB_Exceltotable_lengrentusecarlist AS tb_longrentexpenseimportinfoitemalert READONLY , @ReturnMsg VARCHAR(100) OUTPUT , @IsSuccess BIT OUTPUT ) AS DECLARE @SNID INT DECLARE @DriverNum INT DECLARE @rowcount INT IF ( ( SELECT COUNT(1) FROM @TB_Exceltotable_lengrentusecarlist ) !> 0 ) BEGIN SET @ReturnMsg = ‘导入数据为空‘ GOTO Fail END BEGIN TRANSACTION UPDATE tb_longrentexpenseimportinfo SET carothermoney = t2.carothermoney , cartotalmoney = t2.cartotalmoney , driveraddhours = t2.driveraddhours , driveraddpre = t2.driveraddpre , driverweekendhours = t2.driverweekendhours , driverweekendpre = t2.driverweekendpre , driverholidayhours = t2.driverholidayhours , driverholidaypre = t2.driverholidaypre , divermealmoney = t2.divermealmoney , driverstaymoney = t2.divermealmoney , driverothermoney = t2.driverothermoney , drivertotalmoney = t2.drivertotalmoney , dutyamt = t2.dutyamt , dutyedmoney = t2.dutyamt FROM( SELECT * FROM @TB_Exceltotable_lengrentusecarlist ) t2 LEFT JOIN tb_longrentexpenseimportinfo t1 ON t1.id = t2.id IF ( @@ERROR <> 0 ) BEGIN SET @ReturnMsg = ‘导入失败‘ ROLLBACK TRANSACTION GOTO Fail END ELSE BEGIN SET @ReturnMsg = ‘成功导入‘ + CAST(@ROWCOUNT AS VARCHAR(50)) + ‘条数据‘ COMMIT TRANSACTION GOTO Success END Success: SET @IsSuccess = 1 SET @ReturnMsg =‘修改成功‘ GOTO EndPoint Fail: SET @IsSuccess = 0 GOTO EndPoint EndPoint: GO
UPDATE dbo.TB_ViolationsDetail_Search SET ProvinceID=me.ParentID from TB_ViolationsDetail_Search t1 left join TB_Metadata me ON t1.CityID=me.MetadataID
标签:
原文地址:http://www.cnblogs.com/hbsfgl/p/4813915.html