Page 1 of 1

How to check if there's been new registries in a database

Posted: 19 Jul 2018 04:38
by Sandritto
Hi!

I've created this little program done with batch which prints labels with information from my database into pdf.

I was wondering if there is anyway I could put in the beginning of the program something like this: "everytime a new registry is created in the database execute the program" or kind of "check every 5 mins if there's been any registry created and if yes execute the program".

The first option would be great, just what I need!

Thanks!

Re: How to check if there's been new registries in a database

Posted: 19 Jul 2018 10:38
by aGerman
What kind of database are you talking about? If it has a command line interface then it might be possible. Otherwise it would be rather unlikely since databases are usually binary files.

Steffen

Re: How to check if there's been new registries in a database

Posted: 19 Jul 2018 11:04
by Sandritto
Im working with microsoft SQL server. I'm accessing from my batch file with the sqlcmd command.

Sandro.

Re: How to check if there's been new registries in a database

Posted: 19 Jul 2018 11:19
by Squashman
What is updating the database?

Re: How to check if there's been new registries in a database

Posted: 19 Jul 2018 11:52
by Sandritto
A program called SAP. Each time a user creates an order a new registry is created in the database.

My intention is to run the batch program I mentioned before each time a new registry is created.

Re: How to check if there's been new registries in a database

Posted: 19 Jul 2018 13:22
by aGerman
dbenham answered on SO how to count the number of datasets in a table.
https://stackoverflow.com/questions/295 ... -erro?rq=1
You might use that snippet to run it in a loop and each time compare if the number changed. Not sure if there is a better way. I'm not familiar with sqlcmd.

Steffen

Re: How to check if there's been new registries in a database

Posted: 19 Jul 2018 14:18
by Sandritto
Thank you for the answer, I'll check it first thing tomorrow morning. If I manage to do it I will let you know.

Anymore answers appreciated!