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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Sandritto
Posts: 7
Joined: 19 Jul 2018 04:28

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

#1 Post by Sandritto » 19 Jul 2018 04:38

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!

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

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

#2 Post by aGerman » 19 Jul 2018 10:38

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

Sandritto
Posts: 7
Joined: 19 Jul 2018 04:28

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

#3 Post by Sandritto » 19 Jul 2018 11:04

Im working with microsoft SQL server. I'm accessing from my batch file with the sqlcmd command.

Sandro.

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

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

#4 Post by Squashman » 19 Jul 2018 11:19

What is updating the database?

Sandritto
Posts: 7
Joined: 19 Jul 2018 04:28

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

#5 Post by Sandritto » 19 Jul 2018 11:52

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.

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

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

#6 Post by aGerman » 19 Jul 2018 13:22

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

Sandritto
Posts: 7
Joined: 19 Jul 2018 04:28

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

#7 Post by Sandritto » 19 Jul 2018 14:18

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!

Post Reply