-
This isn't exactly vb, but it's related to the vb project that I'm working on, and you seem to be well rounded. If I create a trigger in SQL Server 7.0, is there a way for me to grab the currentrow that made the trigger fire (on updating an existing record or inserting a new record) without using a select statement against the entire table?
Also, any way to call an external exe from the trigger?
Thanks in advance,
Wade
-
You should examine Transact-SQl help for "Create Trigger". You can use the psuedo tables "inserted" or "deleted".
WRT calling external exe's, I'll look into my docs and get back to ya tomorrow
-
Thanks John...the Inserted pseudo table is just what I was looking for. I'll be doing some research on my end too...hopefully one of us will figure out how to call an exe.
Thanks again,
Wade
-
Here's an idea
Thanks for looking into it. Here's an idea. You can schedule a job which invokes an external app or runs vbscript. Is there a way for a trigger to call a job?
Thanks again,
Wade
-
I don't believe so. Triggers appear to execute T-SQL only. I could, however, be wrong. :)
-
Read my previous reply.
You develop a "tiny" VB or VC++ application whose entire purpose is to POLL a particular Table on the SQL Server. When it finds a record in that table the fields indicate which application to run and what parameters to pass it.
Then you application does a ShellExecute or whatever to kick off the other application and removes the record from the table.
Set the timer for 1 "pulse" every 60 seconds and you wont even notice it running.
Code:
SELECT COUNT(*) AS NumRecs FROM ProcessTable WHERE Status = 'Active'
This is barely even noticable to the system and if the value that comes > 0 you go into process mode otherwise it just resets the time for another 60 seconds and waits.
-
Thanks for the replies and the ideas. There's also a master stored procedure (xp_cmdshell) that can be called.