我很难弄清楚为什么我的代码只有开始部分正在执行。我在问题所在的地方插入了语句“--此点之后没有任何内容正在执行”。任何帮助将不胜感激
IF @i_numrecs = 0
BEGIN
SET @nextid = dbo.Timesheetgetnextid(@EMP, @DATE)
IF @mode = @c_current
BEGIN
INSERT INTO timedetail (
ppenddate,tsdate,empnum,task1,
task2,task3,hours,minutes,
doecode,duration,SOURCE,enteredby,
enteredon,approved,completed,timein,
timeout,id)
VALUES(
@DATE,@DATE,@EMP,' ',
' ',' ',0,0,
' ',0,'BROWSER',@UID,
@actiondate,'N','Y',' ',
' ',@nextid)
END
ELSE
BEGIN
INSERT INTO adjst_timedetail (
ppenddate,tsdate,empnum,task1,
task2,task3,hours,minutes,
doecode,duration,SOURCE,enteredby,
enteredon,approved,completed,timein,
timeout,id)
VALUES (
@DATE,@DATE,@EMP,' ',
' ',' ',0,0,
' ',0,'BROWSER',@UID,
@actiondate,'N','Y',' ',
' ',@nextid)
END
--Nothing after this point is executing
INSERT INTO timesheetchangelog (
empnum,tsdate,tdid,changedate,
changeby,SOURCE,changetype)
VALUES(
@emp,@date,@nextid,@actiondate,
@UID,@TCPIP,'COMPLETION INSERT')
SELECT @changelogid = Scope_identity()
EXEC Auditrecordaction
@emp,
@date,
@payfrequency,
@c_insertaction,
@actiondate,
@UID,
@actionid OUT,
@doaudit OUT
SELECT @doaudit DoAudit, @actionid ActionID
IF Isnull(@doaudit, 0) > 0
BEGIN
IF @mode = @c_current
BEGIN
INSERT INTO timedetail_audit (
EMPNUM,PPENDDATE,TSDATE,TASK1,
TASK2,TASK3,HOURS,MINUTES,
DOECODE,DURATION,SOURCE,TSGROUP,
DEPTCHRG,PAYRATE,TIMEIN,TIMEOUT,
ERRORS,COMPLETED,APPROVED,VERIFIED,
DELETED,PROCESSEDBYPAYROLL,ID,ENTEREDBY,
ENTEREDON,APPROVEDBY,APPROVEDON,PROCESSEDON,
QUANTITY,SHIFT,processed_pd,RUNNUMBER,
overnight,actionid,logid)
SELECT
EMPNUM,PPENDDATE,TSDATE,TASK1,
TASK2,TASK3,HOURS,MINUTES,
DOECODE,DURATION,SOURCE,TSGROUP,
DEPTCHRG,PAYRATE,TIMEIN,TIMEOUT,
ERRORS,COMPLETED,APPROVED,VERIFIED,
DELETED,PROCESSEDBYPAYROLL,ID,ENTEREDBY,
ENTEREDON,APPROVEDBY,APPROVEDON,PROCESSEDON,
QUANTITY,SHIFT,processed_pd,RUNNUMBER,
overnight,@actionid,@changelogid
FROM timedetail
WHERE empnum = @EMP
AND tsdate = @DATE
AND id = @nextid
END
ELSE
BEGIN
INSERT INTO timedetail_audit (
EMPNUM,PPENDDATE,TSDATE,TASK1,
TASK2,TASK3,HOURS,MINUTES,
DOECODE,DURATION,SOURCE,TSGROUP,
DEPTCHRG,PAYRATE,TIMEIN,TIMEOUT,
ERRORS,COMPLETED,APPROVED,VERIFIED,
DELETED,PROCESSEDBYPAYROLL,ID,ENTEREDBY,
ENTEREDON,APPROVEDBY,APPROVEDON,PROCESSEDON,
QUANTITY,SHIFT,processed_pd,RUNNUMBER,
overnight,actionid,logid)
SELECT
EMPNUM,PPENDDATE,TSDATE,TASK1,
TASK2,TASK3,HOURS,MINUTES,
DOECODE,DURATION,SOURCE,TSGROUP,
DEPTCHRG,PAYRATE,TIMEIN,TIMEOUT,
ERRORS,COMPLETED,APPROVED,VERIFIED,
DELETED,PROCESSEDBYPAYROLL,ID,ENTEREDBY,
ENTEREDON,APPROVEDBY,APPROVEDON,PROCESSEDON,
QUANTITY,SHIFT,processed_pd,RUNNUMBER,
overnight,@actionid,@changelogid
FROM adjst_timedetail
WHERE empnum = @EMP
AND tsdate = @DATE
AND id = @nextid
END
END
END