multiple values from BATCH file

  • Hi,

    I am creating a batchfile that calls SQL query in a file

    the batch contains:

    SET/P keyid1=Please enter multiple keyids:

    echo %keyid1%

    SQLCMD -S ttgfgs03 -U admin -P admin -ic:\mult_keyid.sql

    the sql file contains:

    select keyid, namereg, creation_date

    from db_app.dbo.funloc where keyid IN '$(keyid1)'

    Problem is variable "keyid1" is not passed correctly from batch file to SQL query. I have tried values:

    ('GL9300','GL9200')

    'GL9300','GL9200' and

    GL9300, GL9200

    results in syntax error

    How can I enter multiple keyids so that the sql query will run correctly and returns results?

    thanks

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

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