Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Mapping JDBC Adapter - SQL Server SP

Hi,

I am executing a Stored procedure in SQL Server. I want to update morethan one record to a table at a time. my datatype occurences are 1..unbounded. But when I execute the procedure, it updates first record only. Do i need to write specific statement for that in the procedure?

Stored Procedure

-


SET QUOTED_IDENTIFIER ON

GO

SET ANSI_NULLS ON

GO

CREATE PROCEDURE [sp_CustomerProc] (

@CustomerID [char](10),

@Name [char](25),

@Address [char](40),

@PhoneNo [char](10),

@QueryDetails [char](50))

AS If (Select customerid from customer_address where customerid=@CustomerID) IS NULL

BEGIN

INSERT INTO [SAPXI].[dbo].[customer_address]

([customerid],

[name],

[address],

[phone],

[querydetails])

VALUES

(@CustomerID,

@Name,

@Address,

@PhoneNo,

@QueryDetails)

END

ELSE

BEGIN

UPDATE [SAPXI].[dbo].[customer_address]

SET

[customerid]=@CustomerID,

[name]=@Name,

[address]=@Address,

[phone]=@PhoneNo,

[querydetails]=@QueryDetails WHERE [customerid]=@CustomerID

END

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

The File Structure

========================

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_customer_address_file xmlns:ns0="urn:file2jdbc_sp">

<CustomerDetails>

<CustomerID>1005</CustomerID>

<Name>Customer5</Name>

<Address>Chennai</Address>

<Phone>537653265</Phone>

<QueryDetails>Is this working?</QueryDetails>

</CustomerDetails>

<CustomerDetails>

<CustomerID>1006</CustomerID>

<Name>Customer6</Name>

<Address>Chennai</Address>

<Phone>537653265</Phone>

<QueryDetails>Is this working?</QueryDetails>

</CustomerDetails>

</ns0:MT_customer_address_file>

Please advice.

Thanks,

Sri.

Former Member
Not what you were looking for? View more on this topic or Ask a question