cancel
Showing results for 
Search instead for 
Did you mean: 

sqlcli - running sql scripts with parameters.

Former Member
0 Kudos

How do I execute sql scripts from sqlcli that I need to parameters to the sql?

If I have a file called count.sql that contains:

select count (*) from $1

//

select count (*) from $2

//

quit

//

How do I execute the script with sqlcli and pass parameters?

Based on the maxdb documentation I thought I would be able to do this, but it doesn't work:

sqlcli \c -d MAXDB1 -u test,test -i 1.sql TABLEA TABLEB

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Jon,

Use -i option to run the sql script file in sqlcli.

I used sqlcli -d <dbname> -u <dbuser>,<password> -i <filename.sql> and succeeded.

And make sure to use // in delimiter after every query.

e.g

truncate table <tablename>

//

truncate table <tablename>

Regards,

Abhishek Kalra

Former Member
0 Kudos

Hello,

We are installing ERP2005 on solaris 10 with MAXDB7.6 with build 35. During installtaion the Import ABAP phase stucks and running for a so long time. As per the note SAPNOTE :848436 we have been trying to execute the statment

CHECK TABLE "/MAXDB/INDEXSTATEMENTS" WITH LONG CHECK.

which may free up the load for installation.

But we are unable to execute the above SQL statement.

It is very urgent since we are not able to complete the installation from past 3 days....

Could you please some one able to help us to finish the installation. I am very

much greatful to you all..

Regards,

Sankaranarayanan.G

SAPBASISCONSULTANT

markus_doehr2
Active Contributor
0 Kudos

What did you try to do? With what tool did you try? Do you get an error message?

--

Markus

Former Member
0 Kudos

Please start a new thread for your question, instead of posting on a thread I started with a different topic.

Thank you.

alexander_schroeder
Participant
0 Kudos

Hello Joe,

sorry, there is no such functionality in the sqlcli tool. You can only supply

some SQL already at the command line (for very simple usage scenarios).

Regards

Alexander Schröder

Former Member
0 Kudos

Thanks Alexander. Is there any maxdb command line tool that provides this functionality?

Former Member
0 Kudos

Hi Joe,

can you try:

sqlcli [<options>] -i <file>

The call options are explained here: http://maxdb.sap.com/currentdoc/12/b72640b32ce901e10000000a155106/frameset.htm

The file can be, for e.g.:

CREATE TABLE city

(zip CHAR (5) KEY CONSTRAINT zip BETWEEN '10000' AND '99999',

name CHAR(20) NOT NULL,

state CHAR(2) NOT NULL)

//

CREATE TABLE customer

(cno FIXED (4) KEY CONSTRAINT cno BETWEEN 1 AND 9999,

title CHAR (7) CONSTRAINT title IN ('Mr', 'Mrs', 'Company'),

firstname CHAR (10) ,

name CHAR (10) NOT NULL)

//

COMMIT

Thanks,

Ashwath

Former Member
0 Kudos

As you can see in my example, that is the syntax I tried.

And as I stated in the comment above, I already referenced the documentation.