I have to two tables employee
and department
.
Employee
Id, Name, JoiningDate, SpecialRegistrationDone, DepartmentId
Department
DepartmentId, Name
There is a special department with DepartmentId = 2
and Name = "AI"
.
There is a Java service pushing the data to Employee
and Department
tables.
Now, I have to write a polling service (polling frequency once in 15 minutes) which satisfies the condition
select e.*
from Employee e
inner join Department d on e.DepartmentId = d.DepartmentId
and e.DepartmentId = 2
and e.JoiningDate > cast(GetDate() as date)
and e.specialRegistrationDone = 0
If there are any records fetched then call a Web service say http://specialdepartmentregistration/register and pass the employee details there.
One way to write is to write a Java service which polls the database and execute this query, get the results and calls the web service for resultset.
I am looking at a away to create a service on the SQL Server side only which executes the query and call the web service. How can I write that ? Is it even possible in SQL Server 2014?