sql_dru
sql_dru

Reputation: 321

Get Next Value from a SQL Server Sequence via Remote Database Link from Oracle?

I have a sequence in my SQL Server database. I am using ODBC Driver 17 installed on my Oracle server to connect to the SQL Server instance. When I run

select "ADDRESS_SEQ".nextval@SQLLINK from dual

I get the error:

ORA-02070: database SQLLINK does not support sequence references in this context.

Creating a synonym and selecting nextval from that synonym results in the same error message.

How can I access a SQL Server sequence from an Oracle database?

Upvotes: 0

Views: 1043

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89361

Wrap the call to

select next value for ADDRESS_SEQ

in a custom SQL Server stored procedure, use Passthrough SQL, or call the sp_sequence_get_range system stored procedure.

Upvotes: 1

Related Questions