Installing a stored procedure with isql

  • Hi,

    I am writing an installation program for a product. As part of the installation I collect information from the user and create a database.

    A part of the database is a stored procedure that creates multiple index structures on my a table - it is defined as follows:

    CREATE PROCEDURE ArchBuildIndex

    As

     CREATE  INDEX [JDHist0] ON [dbo].[JDHist]([JDJSDATE]) ON [PRIMARY]

    GO

     CREATE  INDEX [JDHist00] ON [dbo].[JDHist]([JDJNAME]) ON [PRIMARY]

    GO

     CREATE  INDEX [JDHIST01] ON [dbo].[JDHist]([JDSYSID]) ON [PRIMARY]

    GO

    When I try to execute this with isql.exe from the installation program I get an error message because the processor assumes that each GO tells it to execute the command. Obviously - this is not what I want to do - is there a way to "group" the commands of the procedure so I can install them?

     

  • use the -c parameter

    from BOL isql-utility :

    -c cmd_end

    Specifies the command terminator. By default, commands are terminated and sent to SQL Server 2000 by entering GO on a line by itself. When you reset the command terminator, do not use Transact-SQL reserved words or characters that have special meaning to the operating system, whether preceded by a backslash or not.

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • This would not work with QA or any scripting tool. In the stored procedure, do not use hte "go" keyword. Just put the 3 index creates.

Viewing 3 posts - 1 through 3 (of 3 total)

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