Well,
A very simple way to shutdown the system using the SQL Server stored procedure xp_cmdshell
Write this command
xp_cmdshell 'shutdown -f -s -t 0' --First enable the xp_cmdshell stored procedure
--Programs-->Microsoft SQL Server 2005-->Configuration
--Tools-->SQL Server Surface Area Configuration
-->SQL Server Surface Area Configuration for features
-->xp_cmdshell->Enable xp_cmdshell