Search code examples
linked-serversql-server-2017

Sql Server - Select Into Linked Server


I linked an oracle db to my sql server.

I need to create a same table as linked server on my local db.

I'm trying to execute SELECT INTO query but I taking an error.

SELECT * INTO ABC_SYSUSERS FROM [OfficeOracle]..[PROJECTA].[SYSUSERS] 

This is my error message.

The OLE DB provider "ORAOLEDB.Oracle" for linked server "OfficeOracle" supplied inconsistent metadata for a column. The column "USERNAME" (compile-time ordinal 1) of object ""PROJECTA"."SYSUSERS"" was reported to have a "DBCOLUMNFLAGS_ISFIXEDLENGTH" of 16 at compile time and 0 at run time.

Any solution ?


Solution

  • Actually, I could not fix the error which I mention above but I fixed my problem with using OPENQUERY;

    SELECT * FROM OPENQUERY(LinkedServerName, 'SELECT * FROM DBName.Schema.Table')