cancel
Showing results for 
Search instead for 
Did you mean: 

Batch executing SQL Statements stored in a file in SAP DB

Former Member
0 Kudos

hi,

I am using SAP DB as database in my j2ee application. As a part of the application purpose, i need to insert a large no. of records in to the database directly. I have created the SQL file which contains the insert statements for the records

Now i need to execute this file sothat the insert statement which are inside the file get executed. I am using SQL Studio to access to the Database.

I would like to know whether any options are available in SQL Studio to for executing a SQL File.

Kindly help

Best regards,

Sudheesh...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I am not sure if you must write your batch file , in the way you have show above.I think there needs to be a kind of separator between the queries.

Please make sure that the syntax of the batch file is right.

Please see if it works when you follow the following guidelines(You will need to try,as I have not verified)

1.The individual commands are in individual rows and separated by a separator.

2.You can specify the separator used in the batch file . try // ,if that does not work confirm if there is no other recommended separator.

3.Do not enter additional spaces in the batch file. The following two separators, for example, are not identical for the database system:

//

<blank>//

Regards,

Harish

Message was edited by: HARISH SUBRAMANIAN

Former Member
0 Kudos

Hello harish,

Initially i worked by putting the delimiter ';' to each statement. But it was not working.

Now i have inserted '//' after each atatement as given below,

INSERT INTO mas_options VALUES('DE','SCPRLD','41','ALL','5F1','Anmeldung','')

//

INSERT INTO mas_options VALUES('DE','SCPRLD','41','ALL','5F3','Anmeldung','')

//

And now it is working fine.

Thank you very much for your help...

Best regards,

Sudheesh

Answers (2)

Answers (2)

Former Member
0 Kudos

This link clearly explains how you must execute multiple sql statements,this should work for a batch file too.

http://help.sap.com/saphelp_nw04s/helpdata/en/ee/1c5beeeba711d4aa2800a0c9430730/frameset.htm

Please view point 6,on this document.

I am sure this should solve your problem,

Regards,

Harish

(Please award points,thanks in advance)

Message was edited by: HARISH SUBRAMANIAN

Former Member
0 Kudos

Hi,

I believe that the solution to your problem lies in creating sql studio objects.Please refer to the link below.Select the link "sql dialog" on the page.

The following options are available for sql dialog.

The following options are available in the SQL dialog:

· Creating and executing SQL statements

· Setting parameters for SQL statements

· Importing and exporting SQL statements

Select the "Importing and exporting sql statements" link on this page to know more about it.This will tell you how to import sql statements from ascii files.

Basically,what you need to do is From the context menu for the SQL dialog, choose Import File or Export File.

The link I have provided,gives a lot of other information as well.

http://help.sap.com/saphelp_nw04s/helpdata/en/ee/1c5bdfeba711d4aa2800a0c9430730/frameset.htm

Hope this helps.

Regards,

Harish

(Please award points for helpful answers)

Message was edited by: HARISH SUBRAMANIAN

Former Member
0 Kudos

Hello harish,

I can import the file to the SQL Dialog. But when i try to execute the statements, It is showing some error messages since the dialog contains many SQL insert Statements as given below,

INSERT INTO mas_options VALUES('DE','SCPRLD','41','ALL','5F1','ausgenommen','e')

INSERT INTO mas_options VALUES('DE','SCPRLD','41','ALL','5F3','ausgenommen','')

INSERT INTO mas_options VALUES('DE','SCPRLD','19','ALL','UEEP 5','Postverkehr','')

INSERT INTO mas_options VALUES('DE','SCPRLD','19','ALL','LAAH 5','Befreiung','')...

If i select any one statement and execute, then it is working fine. But i can't execute picking up individual statement since i have to insert some around 12 thousands of records

<b>

So i would like to know whether any options are available for a batch wise execution of these statements an any tool.</b>

Kindly help me

Best regards,

Sudheesh...