Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 910669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:04:50+00:00 2026-05-15T17:04:50+00:00

Task: Write timestamps into MS SQL database table every second. Solutions: External application which

  • 0

Task:

Write timestamps into MS SQL database table every second.

Solutions:

  1. External application which writes timestamps by schedule (Sql agent for example).
  2. Stored procedure, which writes timestamps in infinite loop.

Questions.

  1. Which of the solutions is best?
  2. Is there any drawbacks of running infinite loop in stored procedure?
  3. How to start stored procedure after server reboot?
  4. Any other solutions?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:04:51+00:00Added an answer on May 15, 2026 at 5:04 pm

    1, Both have advantages and disadvantages. Evaluate and choose based on your environment

    Procedure Advantages:
    – Don’t have overhead of SQL Agent processing once per second. (In fact, I don’t think you can get SQL Agent to consistantly launch the same job once per second.)
    – I don’t think a procedure in WAITFOR mode is using resources – but you’d want to check

    Procedure Disads:
    – If procedure fails (gets stopped somehow), it won’t start up. (Unless you have a SQL Agent job running to check if the procedure has stopped, in which case might as well go with the procedure)
    – Might be easier to stop/break than you’d think (concurrency/deadlocks, detached DBs, manually stop during maintenance then forget to restart)

    Job Advantages:
    – If job fails (perhaps db is unavailable), next job will still get launched

    Job Disads:
    – Seems very kludgy, having SQL agent run every second. Measure required server overhead if you do this.
    – If SQL Agent fails or is stopped, job won’t run

    A suggestion: must it be once per second? Can it be once per 5, 10, 15, or 30?

    2, Shouldn’t be any, barring what’s mentioned above. Make darn sure you can’t hit locking, blocking, or deadlock situations!

    3, Like @gbn says, sp_procoption

    4, Nothing that doesn’t involve cumbersome tricks based on pessimistic locking techniques, or byzantine logic based on the timestamp (not datetime) datatype. The best fix would seem to be the long-term one of combining those two databases into one, but that’s not a short-term option.

    Out of sheer paranoia, I’d combine the two like so:

    • Job set to run every 2, 3, or 5 minutes
    • Job calls procedure that updates your timesampt, then waitfors a few seconds
    • Procedure does not stop, so job continues to run; while job is running, it will not be started (because it’s still executing)
    • If procedure somehow dies, job will launch it again next time it’s scheduled to run.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should use the Qt Resource System. See the section… May 16, 2026 at 2:39 pm
  • Editorial Team
    Editorial Team added an answer You can do that with the following code which is… May 16, 2026 at 2:39 pm
  • Editorial Team
    Editorial Team added an answer Take a look at Sencha Touch. They provide a carousel… May 16, 2026 at 2:39 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

can somebody help me to write a sql select to perform a task. So
I am trying to write a SQL Server query but have had no luck
I am trying to write a MSBuild logger module which logs information when receiving
i'm supposed to write code which when given a text file (source code) as
Is there a Mysql statement which provides full details of any other open connection
My present task is to dissect tcpdump data that includes P2P messages and I
I would like to write an app on Android to upload my GPS location
I wrote a temperature logger Python script and entered it as a scheduled task
I want to store the contents of an xml file in the database. Is
I have an existing Django application with a pretty typical model implementation that's backed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.