Jump to content
  • 0

SQL Help insert on startup


masterking3000

Question

1 answer to this question

Recommended Posts

  • 0

You could always make the start up bat file that the server use call for this line: 

sqlcmd -s localhost\mysqlserversomethingsomething -i C:\yourscript.sql

If above doesn't work try this:

sqlcmd -S DBserverName -U username -P password -i "C:\yourscript.sql"

and in the myScript.sql you add the script to open the stats table and print current date and time:

INSERT INTO TABLE (stats) VALUES SELECT getdate()

This should update the table stats to the current date that the sql server uses.

​Alternatively you can also use BEC to once in a while run a .bat file which uses this line aswell, if you don't want to include it in your restart file.
I have done this with my automatic database backup, which is being run every 15 min.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...