using dbisql with parameters

169 views
Skip to first unread message

Jun Macalalad

unread,
Oct 30, 2013, 12:16:47 AM10/30/13
to iq...@googlegroups.com
Hi all,

I've created a DOS script to execute a backup using dbisql and pass a couple of parameters but I have a problem if a parameter is a string like 'INCREMENTAL SINCE FULL'

Here's the script:
dbisql -nogui -d1 -datasource IQPROD_154 "D:\DBA\sql\backup_PD.sql" [%DOT%] [%OPTN%]

where DOT is: SET DOT=%date:~0,3%
and OPTN is: SET OPTN=INCREMENTAL SINCE FULL

The SQL is as below:
====================================
parameters DoW, OPTN;

BACKUP DATABASE
ATTENDED OFF
CRC OFF
{OPTN}
TO 'H:\SybaseIQ\Dumps\DW_Prod\{DoW}\DW_Prod.dmp0' size 6000000
===================================

If OPTN is FULL or INCREMENTAL, no problem but if OPTN is set to a string like 'INCREMENTAL SINCE FULL', I get a syntax error on line 1, column 1
------------------
Could not execute statement.
Syntax error near 'D:\DBA\sql\backup_PD.sql' on line 1
SQLCODE=-131, ODBC 3 State="42000"
Line 1, column 1
"D:\DBA\sql\backup_PD.sql" [Wed] [INCREMENTAL SINCE FULL]
-------------------
Question is:

Do you have any idea on how to pass a 'string of characters (space included)' in dbisql proc?

Thanks and regards,
Jun

cjd

unread,
Nov 5, 2013, 10:05:17 AM11/5/13
to iqgoogle

Jun,

# unix
DOT=$(date+"%Y%m%d")
OPT="incremental since full"
#set your SQLCONNECT
dbisql Bck.sql  [$DOT] ["$OPT"]        
 ## Should do it  

---------  Bck.sql -----------------
Parameters DOT , OPT ;
backup database {OPT}
to '/YourDir/BSF_{DOT}' ;

Have a nice day.
cjd

--
You received this message because you are subscribed to the Google Groups "iqug" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iqug+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Macalalad, Jun

unread,
Dec 20, 2013, 12:28:08 AM12/20/13
to iq...@googlegroups.com

thanks.. got this to work

Reply all
Reply to author
Forward
0 new messages