isql from a batch file

  • Im trying to create and execute a simple stored procedure from a batchfile.

    in the batch file I use just to test the batch file

    isql /U username /P password /S servername /d database name

    CREATE PROCEDURE dbo.IMPORT_DATA_TEST_SP

    @P_OBJECT_TYPE NVARCHAR(2),

    @R_OUT_COUNT INTEGER OUTPUT

    AS

      /*  ------------------------------------------------------------------------ */

      /*    Procedure IMPORT_DATA_TEST_SP                                          */

      /*    Created   08/11/2006                                                   */

      /*    Description:                                                           */

      /*    A test stored procedure that can be used for testing command-line      */

      /*    calls using isql e.g. when running from a batch file.                  */

      /*  ------------------------------------------------------------------------ */

      DECLARE @V_COUNT int

      SET NOCOUNT ON

     SELECT @V_COUNT = COUNT(*)

     FROM sysobjects

     WHERE xtype = @P_OBJECT_TYPE

     SET @R_OUT_COUNT = @V_COUNT

      RETURN

      SET NOCOUNT OFF

    DECLARE @V_NUM integer

    set @V_NUM = 0

    EXEC IMPORT_DATA_TEST_SP 'U', @R_OUT_COUNT = @V_NUM output

    SELECT @V_NUM

    GO

    'U' is user table

    The problem is, when I run this, the command prompt window returns the 1st line and then >1 and  then nothing else

  • found where I was going wrong..thanks

  • Mind sharing the solution?

    Also, using ISQL is "Death by SQL" because, compared to OSQL, it is severely deprecated.  Change the ISQL to OSQL and you'll be much better off.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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