cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple records update using JDBC

Former Member
0 Kudos

Hi sap Gurus..

How to <b>update multiple records</b> in MS SQL 2000..using <i>receiver JDBC adapter..</i>

Help me please..

kumar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi;

There are two ways to do this .

First

<StatementName1>

<dbTableName action=”UPDATE”>

<table>realDbTableName</table>

<access>

<col1>val1</col1>

<col2>val2new</col2>

</access>

<key1>

<col2>val2old</col2>

<col4>val4</col4>

</key1>

</dbTableName>

</StatementName1>

Here keep the occurance of <StatementName1> 0...unbound

Second

<StatementName6>

<anyName action=” SQL_QUERY” | “SQL_DML”>

<access>SQL-String with optional placeholder(s)</access>

<key>

<placeholder1>value1</placeholder1>

<placeholder2>value2<placeholder2>

</key>

</anyName >

</StatementName6>

Here use SQL Query in the action tab to update teh table based on the place holder values

action= SQL_QUERY | SQL_DML This structure enables you to transfer more complex SQL statements to the database directly using the adapter. You have the option of using placeholders in these SQL statements, which can be listed in the subsequent keyblock. This makes it easy to generate complex, parameterisable SQL statements.

Details on the structure:

&#9675; The name of the structure is arbitrary. Unlike in the usual statement types, no table name or stored procedure name is expected in the default setting.

&#9675; If the SQL statement represents a query to the database (SELECT), choose Action=SQL_QUERY.

&#9675; If it represents a call from the SQL Data Manipulation Language (UPDATE, INSERT, DELETE), choose Action=SQL_DML.

&#9675; The first element in the structure must have the name <access> and contain a valid SQL call for the respective mode, optionally with placeholders (see below).

&#9675; If you use placeholders, these must be listed in the element with the name <key>. The names of the placeholder elements must be identical to those used in the SQL string (where they still have the $ character). In the above example <StatementName6>, the strings $placeholder1$ and $placeholder2$ contained in the SQL string are replaced with value1 or value2 before the SQL statement is executed.

Mudit

Award point s if it helps

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Whats is the Action that you are trying?

Is it Insert or is it Update or is it Update_Insert?

Irrespective of the action, you need to have multiple ACCESS level tags in the output one for each Record. This will Update multiple records in the Database.

The ACCESS tag should hence have an occurence of 0 to unbounded. and each recorsd in the source should create a ACCESS level tag with the correspodning lower level tags.

More,

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

Regards

Bhavesh