You misunderstand basis. Any program itself contains a message loop. At your service, it is not. When you start your service, it starts a thread. More service, do nothing, nor any instructions there for this reason it completes its work. On this you and inform.
In order for service has not ended, you need to implement event implementation. See the attached example. Just pay attention that the cycle is better to check the property Terminated. This property is true when the service portebuetsya completion. Otherwise you risk to be able to stop him. This also applies to Thread.
Implementation of SQL in the cycle seems unlikely. Obviously you need a single execution of this command. Consequently, the team should be run at the coming of the events (eg onset of a certain time). Therefore, one should check in the loop is not the right time has come. If the time has come - the command (it is quite possible to run n
pritaeas commented: Good examples +14