I’m sending a demo trigger
"
CREATE TRIGGER MyTestTrigger
ON dbo.tblCursor
AFTER INSERT
AS
Declare @ino int
set @ino=1
WHILE (@ino<(select count(*) from tblcursor where ExpieryDate>getdate()))
BEGIN
UPDATE tblCursor
SET IsActive = 'true'
WHERE ExpieryDate>getdate()
set @ino=@ino+1
END
select * from tblcursor
”
In my original trigger I’m using CURSOR instead of Select Command ,now again i’m telling a problem
n my prblm is that I just want to invoked that trigger ‘MyTestTrigger’ object without performing any Commands(Insert,Update,Delete)
whenever sql server management studio starts it’s automatically invoked that trigger…….
It’s not possible. You can’t invoke a trigger since they act upon events such as inserts/deletes/updates. If you want to invoke your statements, convert them to a stored procedure.
Besides, your
MyTestTriggeris anAFTER INSERTtrigger, which means that unless you insert something; nothing will happen.As far as invoking your statements when you start Visual Studio, create a command wrapper that first executes your SQL statements and then starts Visual Studio.