Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dtong004
Constraint Violating Yak Guru
281 Posts |
Posted - 2001-08-08 : 18:35:02
|
| I have a stored prcedure to insert data into a table. I call exec sp_, It increase my @@trancount.I have to give "commit" to commit the insert process. Does anyone know what happend:Here is the code:CREATE PROCEDURE CASH_BUILD_P ASSET ANSI_DEFAULTS ONSET NOCOUNT OFFDECLARE @RUNLOG INTSELECT @RUNLOG=CONVERT(INT, CONVERT(VARCHAR(8), GETDATE(),12)) BEGIN TRANINSERT MGMT..CASH_NEW (RUNLOG_ID, XYZ, CSTATE, CZIP, EMP_ID)SELECT @RUNLOG, XYZ, CSTATE, CZIP, U.I_ID FROM CASH_BCP C LEFT OUTER JOIN CASH..UNITS U ON C.UNIT=U.UNITIF @@ERROR<>0 BEGIN RAISERROR ( 'LOADING CASH ERROR HAPPENED', 16, 1) ROLLBACK TRAN ENDELSE BEGIN PRINT ' LOADING CASH SUCCESSFUL. ************************************************' COMMIT TRAN ENDRETURNGO |
|
|
|
|
|