Building a Stored Procedure from VB

Building a Stored Procedure from VB

Post by Don Heninge » Thu, 04 Jul 2002 09:08:43



I have a question regarding stored procs.  Is it possible
to programmaticly build a stored proc (from VB6), save it
to the server and run it at a later date?

I am in the middle of constructing a "data cleaner" for a
client and they have asked for the ability to dynamicly
create their own stored proc's.

Any help would be greatly appreciated.

Thanks,

Don

 
 
 

Building a Stored Procedure from VB

Post by Val Mazu » Thu, 04 Jul 2002 10:59:39


Hi,

Yes, you can do that. What you need to do is to prepare your SP text as a
string in Vb and execute prepared string using Execute method of ADO
connection or Command object

Dim lcSQL as string
Dim loConnection as ADODB.Connection
......
lcSQL="CREATE PROCEDURE ....."
loConnection.Execute lcSQL

Now you will have SP, stored in database and you could execute it
--
Val Mazur
Microsoft MVP


Quote:> I have a question regarding stored procs.  Is it possible
> to programmaticly build a stored proc (from VB6), save it
> to the server and run it at a later date?

> I am in the middle of constructing a "data cleaner" for a
> client and they have asked for the ability to dynamicly
> create their own stored proc's.

> Any help would be greatly appreciated.

> Thanks,

> Don


 
 
 

1. SQL2K: Debugging Stored procedures from VB/VB.NET

Hi guys

I'm having a little trouble debugging stored procedures from VB6 or VB.Net
with SQL2000 - all of this is running on a single PC running Win2K Pro.

In VB6, I get the option to debug a stored procedure in the data view
window, can enter the parameters and set a breakpoint in the TSQL - as soon
as I try to execute some code I can an error that refers me to the SQL Logs.
The log says the following "Cannot load the DLL sdi, or one of the DLLs it
references. Reason: 126(The specified module could not be found.).".

In VB.Net, I don't even get the option to debug a stored procedure.

Does anyone have any ideas?
Cheers
Andy

2. How to Determine Size of Each Table and Index?

3. Building Extended Stored Procedures

4. IS Consultng Position with MN Firm

5. Building a stored procedure

6. Insert Stmt: Text with Carriage return

7. Build SELECT statements from variables in Stored Procedure

8. US-CA-Sacramento Technical Support Engineers, Unify Corporation

9. Build SQL Statement in Stored Procedure by Passing Variables

10. Build a where clause in stored procedures

11. Dynamically built query in a Stored Procedure

12. Build Complex Stored Procedures Easily

13. building temporary tables in stored procedures