I am trying to add a trigger on a SQL table in Visual Studio 2013 but I'm getting an error
SQL80001: Incorrect syntax near 'End Of File' Expecting '.'
This is the SQL code:
CREATE TRIGGER SomeMethod1
ON UserTable
AFTER INSERT AS
EXTERNAL NAME "Main.Site.Header1.OnEvent"
It is the first time I'm trying SQL trigger so maybe I missed something..
Anyone have an idea of what's the problem ?
In SQL Server, double quotes act the same as square brackets and delimit names of objects. For example:
SELECT * FROM "Customers"
It's not necessary here but if the name of an object is complex you need to delimit it with either double quotes or square brackets
SELECT * FROM [Order Details]
SELECT * FROM "Order Details"
If an object is referred to with multiple parts like a schema or database, you would have to delimit each individual part, not quote the whole name as in: SELECT * FROM "dbo"."Customers" not
SELECT * FROM "dbo.Customers"
In the code you showed, you have the whole four part name quoted:
"Main.Site.Header1.OnEvent"
EXTERNAL NAME requires three parts, the first is the assembly, the second is the class and the third is the method. If you have a class with a namespace then it has a two part name. I am guessing from context what you really want here is:
Main."Site.Header1".OnEvent"
because Site is the namespace and Header1 is the class, so the second parameter would need to be delimited to indicate the complex name, the same way "Order Details" would need to be delimited because it contains a space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With