I need to call a command or API function to stop and then restart SQL Server 2008 each other day. Before, I had MSSQL Server 2000 and used the following commands from within my program:
net stop SQLServerAgent
net stop MSSQLServer
then
net start MSSQLServer
net start SQLServerAgent
But with SQL Server 2008 they don´t work, it seems the services are named different than in previous versions (for example the SQL 2000 version).
Note:
I'm using SQL Server 2008 Express Edition for the testing and I'm not sure if the service is called the same in the "regular" (not Express) edition.