cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with MSSQL DB

former_member1193316
Participant
0 Kudos

Hi,

Here R3 DB is MSSQL. Wen i use the sme sql commands like select,insert etc., its going to dump.

Then I tested with another R3 server whose DB is ORACLE, there the code is working 5n.

How to solve this problem, How can i use sql commands by using MSSQL DB.

kindly let me knw what i hav to config?

Regards,

Venkat

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Venkat,

could you show us a small piece of your code which doesn't work?

Gudmundur

former_member1193316
Participant
0 Kudos

Hi Karlsson,

Here is the sample code i used,


DATA: BEGIN OF wa,
        connid   TYPE spfli-connid,
        cityfrom TYPE spfli-cityfrom,
        cityto   TYPE spfli-cityto,
      END OF wa.
 
DATA c1 TYPE spfli-carrid VALUE 'LH'.
 
EXEC SQL PERFORMING loop_output.
  SELECT connid, cityfrom, cityto
  INTO   :wa
  FROM   spfli
  WHERE  carrid = :c1
ENDEXEC.
 
FORM loop_output.
  WRITE: / wa-connid, wa-cityfrom, wa-cityto.
ENDFORM.

Regards,

Venkat

0 Kudos

Hello Venkat,

EXEC SQL means "native" sql so the syntax has to conform to the underlying database system, so you have to be careful with portability. SQL Server SAP databases are always configured as case sensitive. The tables you are using have uppercase names (like all SAP tables), so you have to use uppercase names in EXEC SQL:

EXEC SQL PERFORMING loop_output.

SELECT CONNID,CITYFROM,CITYTO

INTO :wa

FROM SPFLI

WHERE CARRID = :c1

ENDEXEC.

Gudmundur

former_member1193316
Participant
0 Kudos

Same code is working in another R3 whose DB is Oracle.

0 Kudos

Oracle is not case sensitive, SQL Server is.

Best Regards,

Gudmundur

former_member1193316
Participant
0 Kudos

I checked it, even though it is not working

0 Kudos

Hi Venkat,

if you change your coding to use uppercase field and table names like I showed, it will work on both oracle and sql server.

Of course EXEC SQL isn't necessary for tables like SPFLI which are in the data dictionary, you should use normal OPEN SQL for that, and there case doesn't matter for any database.

If your code still isn't working with the change to uppercase, then send us again an example which doesn't work.

Gudmundur

Answers (0)