我很难搞清楚为什么只有我的代码的开头部分才会执行。我已经插入了声明' - 在此点之后没有执行'问题所在。任何帮助将不胜感激
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
答案 0 :(得分:0)
如果这件作品没有错误地执行....
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
然后下一个语句应该并且将尝试执行。我猜你在这里错过了一些错误。尝试从管理工作室以块的形式运行它,以确保它们实际上已成功执行。