Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pass Parameter to Interactive SQL via Command Line

346 views
Skip to first unread message

Tony

unread,
Sep 6, 2003, 7:04:41 AM9/6/03
to
Is there a way to pass a parameter to the Interactive SQL
via the command line?

The command line looks like:
dbisql -c "uid=dba;pwd=sql;dbf=D:\Temp\%1\meteroneany.db"
D:\Temp\subscribe.sql

I call a .bat file and pass the %1 parameter to the dbisql
command line. The %1 parameter is the mluser I wish to
subscribe. The dbisql command also calls the subscribe.sql
file.

The subscribe.sql looks like:

parameters mluser;
create synchronization user {mluser}
create synchronization subscription to meteroneremote
for {mluser}

Currently I have to manually enter the mluser parameter.
Is there a way to pass the %1 parameter to the subscribe.sql
automatically?

Breck Carter [TeamSybase]

unread,
Sep 6, 2003, 9:18:36 AM9/6/03
to
Here is a .BAT file; code it all on one line...

"%ASANY8%\win32\dbisql.exe" -c "ENG=test;DBN=test;UID=dba;PWD=sql"
READ dbisql_read_parameters.sql [Hello, World!]

Here is the dbisql_read_parameters.sql file:

-----
PARAMETERS @message;

MESSAGE '(to console) The @message parameter contains "{@message}".'
TO CONSOLE;

MESSAGE '(to client) The @message parameter contains "{@message}".' TO
CLIENT;
-----

Read about these statements in the Help: READ and PARAMETERS. And
MESSAGE if you want, it's a great debugging tool.

It is straight string substitution without much regard for the
context, as you can see from the parameter reference embedded inside a
string literal.

Pay close attention to the [] and {} bracketing. The @-sign is not
required, it is just my convention for all variable names as opposed
to column names inside SQL scripts.

Breck

bca...@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com

0 new messages