Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Extended Stored Procedures in VB?

Author  Topic 

SMerrill
Posting Yak Master

206 Posts

Posted - 2004-12-11 : 01:00:17
Hello,
Are there any examples out there for writing an Extended Stored Procedure DLL in Visual Basic 6 or Visual Basic .NET ?
Thanks,
~ Shaun

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-12-11 : 08:42:54
I don't know, but why write it as an extended procedure when you can write it as a COM object? It's very easy to use COM via the sp_OA system procedures. See Books Online under "sp_OACreate" et. al.
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-12-11 : 08:50:04
xp's can only be written in C++
Go to Top of Page

SMerrill
Posting Yak Master

206 Posts

Posted - 2004-12-11 : 11:32:32
ATTN: ROBVOLK:
C++ is not my forte, so I'll rule that out.
I have reviewed the help file, and these sp_OA sprocs seem a tad cumbersome, but I'll work with it.
Is there any reason for reticence on my part? That is, it seems you cannot write Event Handlers using Automation Stored Procedures. What other limitations will I run up against?


~ Shaun Merrill
Seattle, WA
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-12-11 : 11:48:09
Without knowing more about what you're trying to do, I can't say. What kind of events are you trying to handle? How does this module interact with SQL Server? Is it something that merely needs to read/write some data or is it more involved? (controlling the server, managing replication or another server process, etc.)
Go to Top of Page

SMerrill
Posting Yak Master

206 Posts

Posted - 2004-12-11 : 12:11:33
I'm doing automation of Outlook XP e-mails to save the attached spreadsheets, then an import from Excel to XP.
I'm not trying to handle any events. I was fishing for a systematic list of all OOP operations that cannot be done in T-SQL, or respond differently than a VB programmer would expect.


~ Shaun Merrill
Seattle, WA
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-12-11 : 12:23:11
The best suggestion I can make is what I posted here:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=43598

For the record, you *CAN* write extended procedures in languages other than C++, but you need a wrapper to handle the interface that SQL Server uses to call it. The only *practical* way to write that wrapper is in C++. I went to a presentation where a programmer had written .Net code that could be called as an extended proc using a C++ wrapper, but he did not have his full code handy, and he himself said that the technique would only be useful in the most esoteric of circumstances.
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-12-11 : 13:24:09
Perhaps I should have stated "All obscurity aside, C++...."
Go to Top of Page

Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2004-12-13 : 03:18:59
quote:
Originally posted by ehorn

xp's can only be written in C++


That is not correct! Any language capable to produce true win32 executables and the ability to export functions can be used. Fortunately VB doesn't belong to these languages.
This link might be of some help: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322884


--Frank
http://www.insidesql.de
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-12-13 : 07:32:26
quote:
Originally posted by SMerrill

I'm doing automation of Outlook XP e-mails to save the attached spreadsheets, then an import from Excel to XP.
I'm not trying to handle any events. I was fishing for a systematic list of all OOP operations that cannot be done in T-SQL, or respond differently than a VB programmer would expect.


~ Shaun Merrill
Seattle, WA



If you must execute this using DTS or something, what about VBScript ?

But -- how do you envision this being executed? Why do this with SQL Server at all? sounds like you can just write an app (in VB or whatever) which might be scheduled to run at certain times, pulls data from the database and then does it's work. This type of stuff doesn't belong in the DB layer if you ask me.

If you are thinking of doing this in a trigger, I'm not sure if that's a good idea. Maybe more details, from a "business rules" perspective, would be helpful.

- Jeff
Go to Top of Page
   

- Advertisement -