linked-server

Create View using Linked Server db in SQL Server

How can I create View on Linked Server db. For Example I have a linked server [0.0.0.0] on [1.1.1.1]. Both db servers are SQL Sserver 2005. I want to create View on [1.1.1.1] using table on linked server. EDIT: On creating using full name, [0.0.0.0].db.dbo.table, I am getting this error. SQL Execution Error. Executed SQL statement: S...

TRY CATCH with Linked Server in SQL Server 2005 Not Working

Hello, I am trying to catch sql error raised when I execute a stored procedure on a linked server. Both Servers are running SQL Server 2005. To prove the issue I have created a stored procedure on the linked server called Raise error that executes the following code: RAISERROR('An error', 16, 1); If I execute the stored procedure dir...

How to reference a sql server with a backslash (\) in its name?

Givens: One SQL Server is named: DevServerA Another is named: DevServerB\2K5 Problem: From DevServerA, how can I write a query that references DevServerB\2K5? I tried a sample, dummy query (running it from DevServerA): SELECT TOP 1 * FROM DevServerB\2K5.master.sys.tables And I get the error: Msg 102, Level 15, State 1, Line...

Using triggers to update linked server table

Can I use triggers to insert or update tables in a linked server? I tried it and got the following error: Unable to start a nested transaction for OLE DB provider 'SQLOLEDB'. A nested transaction was required because the XACT_ABORT option was set to OFF. [OLE/DB provider returned message: Cannot start more transactions on this sessio...

How to get resultset with stored procedure calls over two linked servers?

I have problems filling a temporary table with the resultset from a procedure call on a linked server, in which again a procedure on another server is called. I have a Stored Procedure sproc1 with the following code, which calls another procedure sproc2 on a linked server. SET @sqlCommand = 'INSERT INTO #tblTemp ( ModuleID, ParamID) ' ...

Accessing Active Directory Role Membership through LDAP using SQL Server 2005

I would like to get a list of Active Directory users along with the security groups they are members of using SQL Server 2005 linked servers. I have the query working to retrieve records but I'm not sure how to access the memberOf attribute (it is a multi-value LDAP attribute). I have this temporary to store the information: DROP TABLE...

Linked Server in SQL Server?

Is it possible to create database in linked server? If yes then how. I appreciate your help. Thank You. ...

Performance of inter-database query (between linked servers)

I have an import between 2 linked servers. I basically got to get the data from a multiple join into a table on my side. The current query is something like this: select a.* from db1.dbo.tbl1 a inner join db1.dbo.tbl2 on ... inner join db1.dbo.tbl3 on ... inner join db1.dbo.tbl4 on ... inner join db2.dbo.mysid...

Linked servers SQLNCLI problem. "No transaction is active"

Im trying to execute a stored procedure and simply insert its results in a temporary table, and I'm getting the following message: The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "MyServerName" was unable to begin a distributed transaction. OLE DB provider "SQLNCLI" for linked server "MyServerNam...

How to pass parameters for OPENDATASOURCE

I can connect to a linked server with this: SELECT testNo, soruTuruId, soruNo, cevap , degerlendirenTcNo, degerlendirilenTcNo FROM OPENDATASOURCE('SQLOLEDB', 'Data Source=192.168.150.42;User ID=readerUser;Password=1').akreditasyon.dbo.tblPerfCevap But I have to pass the password as parameter. and I try like this: SET @connectionStri...

Setting up a linked server to another server which isn't in a domain without using SQL authentication?

Server A (SQL2005) is in our primary domain, but server B (SQL2000) is just in a windows workgroup. We are not allowed to join it to the domain, or bad things happen... We also can't enable SQL authentication on server B. We've got domain accounts for A, and matching local accounts on server B. I can connect to B from my local PC o...

How to Insert into remote table using Linked server withint Transaction ?

Hi, My Linked server is setup correctly , I am able to perform below query. INSERT INTO [RemoteServer].[Table] SELECT * FROM [LocalServer].[Table] However when I do the same thing within transaction BEGIN TRAN INSERT INTO [RemoteServer].[Table] SELECT * FROM [LocalServer].[Table] COMMIT TRAN I get Errors like O...

Data-Tier Projects and Linked Servers

I'm trying to use a Data-Tier application involving a linked server and running into an odd problem. Here's what I have: 1) A VS2010 solution which includes a Data-Tier project. 2) The Data-Tier project targets an SQL 2008 R2 server. 3) The SQL server has a working linked server connection to an Oracle database. 4) Views within the ...

openquery issue in SQL Server

Hello everyone, I am using SQL Server 2008 (let us call this source database server in this question discussion), and in SSMS, I have created a linked server to another SQL Server 2008 database (let us call this destination database server in this question discussion). When I issue statement -- select * from [linked server name]....

Problems with sp_addlinkedserver in SQL Server 2000

Hi! I'm having a bit of a problem with moving specific data from one server running SQL Server 2000 (A) and another running SQL Server 2008 (B). I'm writing a script according to customer specifications which is to be executed on A, populating tables in B with data. However, I can't seem to get the server link to work. -- Bunch of decl...

How to access Postgres data from SQL Server (linked servers)

I have the following situation: DB Server 1 is Sql Server 2008 and hosts database A with transaction records DB Server 2 is Postgres and hosts database B with records of prices Server2 is added as a linked server to server1. I need to run a query where for each transaction record on server1 I need to check a number of prices from serv...

Trigger is not working on LInked Server. Both servers are SQL Server 2005

I have link a server with another server. I can access records from linked server and I can also insert record using INSERT statement like INSERT INTO [LINKED-SERVER-IP].MyDb.dbo.Customer (CustomerId, CustomerName) SELECT CustomerId, CustomerName FROM MyCustomers WHERE CustomerId = 5 Above query work ok and insert record but when I us...

SQL Server: Is there an "IF EXISTS" test for a linked server?

I want to be able to programmatically (in T-SQL) check if a specific linked server already exists for my current server and database (so that if the link doesn't exist yet, I can create it). I tried stuff like this: IF OBJECT_ID('myserver\devdb_1') IS NULL BEGIN PRINT 'Does not exist, need to create link' EXEC master.dbo.sp_addlinke...

Linked Server Query Runs But Doesn't Finish?

June 29, 2010 - I had an un-committed action from a previous delete statement. I committed the action and I got another error about conflicting primary id's. I can fix that. So morale of the story, commit your actions. Original Question - I'm trying to run this query: with spd_data as ( select * from openquery(IRPROD,'select * from ...

DB2 error on TSQL

I am getting this error: [OLE/DB provider returned message: [IBM][CLI Driver] [DB2 / linuxx8664] SQL0206N "LS_SCHEDULED_DATE" is not valid in the context where used. SQLSTATE=42703) OLE DB error trace [OLE /DB Provider 'MSDASQL' IColumnsInfo: GetColumnsInfo returned 0x80004005: Msg7339, Level 1, State 1, Line 83 OLE DB provider 'MSDASQL'...