masterking3000 Posted March 27, 2014 Report Share Posted March 27, 2014 Hello, is there a way to insert something into the database on startup of the server? i want, that the server prints the current timestamp from the startup (data + time) into the database in a new table like 'stats'? Is there a way to do this? Link to comment Share on other sites More sharing options...
0 Defent Posted March 27, 2014 Report Share Posted March 27, 2014 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 More sharing options...
Question
masterking3000
Hello,
is there a way to insert something into the database on startup of the server?
i want, that the server prints the current timestamp from the startup (data + time) into the database in a new table like 'stats'?
Is there a way to do this?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now