Why does this code throw an error?
using (ProviderContext db = new ProviderContext())
{
string sqlcommand = @"GO CREATE TRIGGER [Trigger] ON [dbo].[News] FOR insert AS BEGIN SET NOCOUNT OFF insert [Statistics](NewsStatID) select NewsID from inserted update [Statistics] set Hits = '0' update [Statistics] set Positive = '0' update [Statistics] set Negative = '0' END";
db.Database.ExecuteSqlCommand(sqlcommand);
db.SaveChanges();
}
An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
Additional information: Incorrect syntax near the keyword 'TRIGGER'.
Thank you in advance!