Results 1 to 7 of 7

Thread: SQL Server

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    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

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363

    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

  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    I don't believe so. Triggers appear to execute T-SQL only. I could, however, be wrong.

  6. #6
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    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.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    Thanks for the replies and the ideas. There's also a master stored procedure (xp_cmdshell) that can be called.

    Wade

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width