New Stored Procedure NAME

  • Hi,

    I am successful in using the SQL NS for creating new stored procedures from VB. However, the window that comes up when we create a new stored procedure (similar to the one in the Enterprise Manager) comes by default, like,

    "CREATE PROCEDURE [OWNERNAME].[PROCEDURE NAME] AS"

    I want this to be changed like,

    "CREATE PROCEDURE [dbo].<spname> AS"

    where <spname> will be the name of the new stored procedure which will be supplied by the user.. My application will prompt and get it from the user..

    There is no option in the SQLNs library wherein I can specify a name for the new stored procedure.. Only after the window pops up, we have to change the name to some other name which the user wants to give.

    Is there a way I can get the name from the user and then change it accordingly, before the window pops up?? either thru the SQLNS object or ...should I have to use templates?.

    Also, thw Enterpise Manager has the option of saving the strucutre as a template. When I click "Save template", it prompts for "overwrite"?. where is this template information saved, in the system db or machine as a file?.

    Regards,

    Ganesh

  • As I have not played with this myself I can only suggest what I would try. Since you are getting some of this from SQL NS in VB do a find and replace on the section in question and make that uneditable by the user. The have them fill in a parameter for the name. Otherwise I would be interested in what you have done before I can make further suggestions.

  • Thanks for your reply. While using SQLNS for creatng new stored procedure, the window that comes up is the same window what you see when you create a new SP

    using Enterpise Manager. What I am trying to say here, I have no control on the contents of the Editor.. so a find/replace is not possible.

    All we could do is make the window appear.

    Here is the piece of code..

    ****************

    Case SPAction.NewStoredProcedure

    hItem = NSLIB.GetRootItem()

    hItem = NSLIB.GetFirstChildItem(hItem, , "DBObject Stored Procedures")

    nsObj = NSLIB.GetSQLNamespaceObject(hItem)

    nsObj.ExecuteCommandByID(SQLNS.SQLNSCommandID.SQLNS_CmdID_NEW_STORED_PROCEDURE)

    ****************

    I would be happy if you answer this question also..The Enterpise Manager has the option of saving the strucutre as a template. When we click "Save template", it prompts for "overwrite"?. where is this template information saved, in the system db or machine as a file?.

    Regards,

    Ganesh

  • I see now. I just tried using the MS example included with SQL Server install and found no way to hook the window directly.

  • Hi,

    Do you know a workaround or a way to get the desired behavior?.. Tell me one thing.. Where does it save the template info when you hit "Save template" on the window that comes up?..

    I eagerly wait for your reply.

    Ganesh

  • ??. Please help..

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply