Using VB Dlls for Extended Stored Procedures

  • Can this be done? Urgently need an answer to this a simple Yes or No would suffice.

  • According to SQL Magazine (http://www.sqlmag.com/Articles/Index.cfm?ArticleID=14261) "The official Microsoft answer is that you can only write them in C. Certainly VB doesn't work.

    Also Delphi 4 and 5 will work. Delphi Magazine had an article about this in Issue 31. There is a source code download for that issue available on their site - http://www.itcecuk.com"

    Paul Ibison

    email: Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • Just had another thought. If you really want to create a vb dll, depending on your needs, it may be possible to use DTS instead of an extended sp. You can instanciate objects inside a vbscript task, and call their methods as usual.

    Paul Ibison

    email: Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • If you just need VB functionality and not truly extend TSQL with an extended stored proc, then Paul is on the money - compile to a dll, you can execute using an ActivX Scripting Task in a job, using the sp_oa series of sp's (not for the faint of heart), from DTS, or even compile a helper exe that runs the dll that you run on the server (or wherever). I use dll's a lot, works fine.

    One queston - what are you trying to accomplish? Maybe we can offer some other ideas for solving the problem.

    Andy

    Andy

  • quote:


    One queston - what are you trying to accomplish? Maybe we can offer some other ideas for solving the problem.

    Andy, In response to your question..

    I've got a VB program which I was attempting to run within a trigger on certain flags changing.

    The VB program produces a text file and sends e-mails out with the text file attached.

    David


  • I agree with the SP_OAxxx procs instead of an extended stored proc. MS says only C, but be wary of registering extended stored procedures. This is a great way to crash your server.

    Personally, I'd also avoid running this in a trigger. Rather, I'd schedule this to run often (every couple minutes) and check for new records. Then send the email. This way you have not tied your transaction (the insret) to the notification.

    Steve Jones

    steve@dkranch.net

  • David, I'd avoid running things in a trigger if you can help it. Really it depends on the frequency, but you don't want triggers to be long operations. Typically I'd write out what I needed done to a "queue" table, then have my exe/dll process that table, either by polling or running in a job. You could even start the job from the trigger if you wanted, its asynchronous.

    Andy

    Andy

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply