79587388

Date: 2025-04-22 20:26:17
Score: 1.5
Natty:
Report link

The approach by Charlieface is an interesting one. However, it does not address the fact that the number of time intervals (3 in that case) are hardcoded.

Using a stored procedure with a parameter, such as @nTimeInterval = 3 (and a default value of 1) could work.. This code could be modified as such:

select
  tabnm,
  rundt,
  rec_cnt 
from audit_tbl
where rundt IN (
    EXEC Procedure @nTimeInterval = 3; 
)
  and tabname = 'emp'
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @nTimeInterval
  • Low reputation (1):
Posted by: user27821072