troubleshooting Question

Create Stored Procedure in SQL2000 at Runtime

Avatar of DOOM_DAEMON
DOOM_DAEMON asked on
Delphi
2 Comments1 Solution224 ViewsLast Modified:
       I'm familiar with using SQL Server 2000. Also I'm a delphi-mania programmer too (Though I'm not an expert yet) I've created store Proceder in SQL Server 2000 using Enterprise Manager of SQL Server. I named it "spTest". Suppose that it's properties contain SQL statement like this
    "CREATE PROCEDURE [spTest] AS SELECT * FROM MYTABLE ORDER BY FIELD01"
    Then I drop TADOConnection named "AConMain" and TADOStoredProc named "spTEST" in the datamodule. I then set spTest.Connection to AConMain then what I must do next is to set spTEST.ProcedureName to "sptest" Object in SQL Server database ( I skip database name and I assume that you know how to do that) What I want to know is that if I want to Drop a procedure "spTest" and re-create in the same name but with difference SQL Statement, say, to be new statement to
    "CREATE PROCEDURE [spTest] AS SELECT * FROM MYTABLE ORDER BY FIELD02"
    In stead of Arrange by FIELD01, I prefer to Arrange dataset by FIELD02. And let my spTest component Reactivate to have dataset at hand but in difference order. What I don't know is how to do that without create stored procedure directly in Enterprise Manager. I think it's more flexible to do that in my programm.
    You please tell me and show me an example of code to do so, please. I'll return you my points. Thanks.
ASKER CERTIFIED SOLUTION
JDN

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros