Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling a VB program from SQL Server via stored proc or Job ?

Status
Not open for further replies.

roswald

Programmer
Jul 6, 2002
152
US
Can anyone tell me how to execute a VB exe from within SQL Server? I would like to do it within a Custom Stored procedure or in a job created using the SQL Server Agent. If anyone has another idea I would appreciate that feedback also.

Thanks,

Bob
 
Compile it as a COM server and there are specific system stored procs that let you register and run these server from your own custom stored procs

E.g:

sp_OACreate <ClassID.Progid>, @object OUT
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END
EXEC @hr = sp_OAMethod @object, <method_name>, param1, param2, param3, param4, param5
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END
EXEC @hr = sp_OADestroy @object
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END



Hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top