PDA

Click to See Complete Forum and Search --> : Stored Proc in SQL server


Sadovod
Jan 31st, 2001, 08:57 AM
Is there a way to dynamically create Stored Procedure in ASP page using ADO for SQL server ?

msdnexpert
Jan 31st, 2001, 12:12 PM
Kindly elaborate the application wherein you want to dynamically create stored procedures?

Jan 31st, 2001, 01:27 PM
I meant ASP page using ADO,
say,

connection.execute ("create stored procedure"),

some how to store it in server and than to be able to
execute it from ASP page

Feb 1st, 2001, 03:57 AM
Yes, you can do this by executing straight SQL.

Try this:

connConnection.Execute("CREATE PROCEDURE spTest AS" & vbCRLF & "Select field1, field2 from myTable")

This will create a stored procedure called spNew with the following SQL in it:

Select field1, field2 from myTable

When you open the sproc in EM, it looks like this:

CREATE PROCEDURE spTestNew AS
Select field1, field2 from content
GO

You can now execute this sproc as you would execute or use any other sproc.

HtH

Imar