linked-server

Linked SQL Server database giving “inconsistent metadata” error

a 夏天 提交于 2019-11-30 08:29:13
I am currently running a third-party software suite, which uses SQL Server as its database. I have a second instance of SQL Server running in a different location, and some apps that I am building in that instance SQL Server needs to access some data in the third-party software. So, I created an ODBC connection between the boxes, and set up the third-party SQL server as a linked server on my version of SQL Server. As a test, I ran something like the following statement from my SQL server, accessing one of the third-party's tables: SELECT * FROM LinkedServerName.SchemaName.dbo.TableName To

SQL 2005 - Linked Server to Oracle Queries Extremely Slow

筅森魡賤 提交于 2019-11-29 18:58:07
问题 On my SQL 2005 server, I have a linked server connecting to Oracle via the OraOLEDB.Oracle provider. If I run a query through the 4 part identifier like so: SELECT * FROM [SERVER]...[TABLE] WHERE COLUMN = 12345 It takes over a minute to complete. If I run the same query like so: SELECT * FROM OPENQUERY(SERVER, 'SELECT * FROM TABLE WHERE COLUMN = 12345') It completes instantly. Is there a setting I'm missing somewhere to get the first query to run in a decent period of time? Or am I stuck

SQL Server 2012: Add a linked server to PostgreSQL

断了今生、忘了曾经 提交于 2019-11-29 18:34:25
问题 I try to connect a PostgreSQL to SQL Server 2012 server as linked server I found some advices on different forum and follow it. But I'm stuck with an authentication problem. I explain: On the SQL Server, I have install the ODBC driver for PostgreSQL (psqlodbc_09_02_0100-x64). I created a system DSN to a specific database on the PostgreSQL. This DSN work correctly. Using SSMS, I run this command to add the linked server: EXEC master.dbo.sp_addlinkedserver @server = N'lnk_test', @srvproduct=N

View linked server dependencies sql server 2008

巧了我就是萌 提交于 2019-11-29 14:55:19
问题 Does any know how / if it is possible to view all tables/views/stored procedures that depend on a linked server in Sql Server 2008. Basically as if the context menu "View dependencies" was accessible for linked servers? Any help much appreciated. Thanks 回答1: Search for it SELECT OBJECT_NAME(object_id), * FROM sys.sql_modules WHERE definition LIKE '%myLinkedServer%' Or use the free Red gate SQL Search to do the same with a GUI There is no table or feature that tracks dependencies between the

sql server linked server to oracle returns no data found when data exists

半腔热情 提交于 2019-11-29 13:58:48
I have a linked server setup in SQL Server to hit an Oracle database. I have a query in SQL Server that joins on the Oracle table using dot notation. I am getting a “No Data Found” error from Oracle. On the Oracle side, I am hitting a table (not a view) and no stored procedure is involved. First, when there is no data I should just get zero rows and not an error. Second, there should actually be data in this case. Third, I have only seen the ORA-01403 error in PL/SQL code; never in SQL. This is the full error message: OLE DB provider "OraOLEDB.Oracle" for linked server "OM_ORACLE" returned

Workaround for calling table-valued function remotely in SQL Server has even more issues

家住魔仙堡 提交于 2019-11-29 12:21:00
问题 I had a query with a set of parameters that needed to be run multiple times with different parameters, so I wrapped it in a table-valued function. That table valued function needed called from a remote server. Unfortunately, the call fails on the linked server with the error: Msg 4122, Level 16, State 1, Line 29 Remote table-valued function calls are not allowed. Microsoft has acknowledged that "calling a table-valued function remotely" was a feature left out of SQL Server 2008. See: http:/

SQL - Connect to Linked Server with Named Instance

本秂侑毒 提交于 2019-11-29 11:55:40
How do I connect to a named instance of a linked SQL server. If its not linked, I would do the following: ServerName.DatabaseName.dbo.TableName If it is linked, I would assume the following: ServerName\InstanceName.DatabaseName.dbo.TableName but SQL doesn't like the "\" What is the correct syntax Jhonny D. Cano -Leftware- Check this You can surround server name with brackets Martin Kafka the correct syntax is [ServerName\InstanceName].DatabaseName.dbo.TableName . If you are using the default instance, you don't need to specify the instance name. Example using the default instance: [MyServer].

Stored Procedure and populating a Temp table from a linked Stored Procedure with parameters

可紊 提交于 2019-11-29 10:40:14
I have a Stored Procedure (SP) in which I pass in one value. In this SP, I am trying to create/populate a Temp Table from the result of another SP that is on a Linked/remote server. That is I am trying to executute an SP in my SP and populate a temp table which my query will use. I have tried using the following syntax, but it does not work as it seems openquery does not like the "+" or the @param1 parameter. select * into #tempTable from openquery([the Linked server],'exec thelinkedSPname ' + @param1) If I have the parameter value hard coded in this it works fine. select * into #tempTable

Distributed Transaction on Linked Server between sql server and mysql

…衆ロ難τιáo~ 提交于 2019-11-29 10:35:23
I have a table say Table1 on SQL Server 2014 and MySQL both. Table1 ID INT,Code VARCHAR(100) I created a linked server MyLinkedServer in SQL Server using "Microsoft OLEDB Provider for ODBC". **Linked Server ** EXEC master.dbo.sp_addlinkedserver @server = N'MyLinkedServer', @srvproduct=N'MyLinkedServer', @provider=N'MSDASQL', @datasrc=N'MyLinkedServer' EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'MyLinkedServer',@useself=N'False',@locallogin=NULL,@rmtuser=N'username',@rmtpassword='########' Linked Server Settings EXEC master.dbo.sp_serveroption @server=N'MyLinkedServer', @optname=N'data

Could not find server 'server name' in sys.servers. SQL Server 2014

天大地大妈咪最大 提交于 2019-11-29 09:35:31
I recently upgraded our SQL Server from 2005 to 2014 (linked server) and I am noticing that one of the stored procedures which calls the exec command to execute a stored procedure on the upgraded linked server is failing with the error Could not find server 'server name' in sys.servers.Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. The issue is that the linked server exists and I have done tests to ensure I can query the tables from the linked server. Here are the checks I did to see if the