linked-server

SQLSMS Intellisense on linked server

时间秒杀一切 提交于 2020-06-08 17:37:06
问题 I'm trying to work Microsoft SQL Server Management Studio 10.0.5538.0 (latest right now) with Intellisense on linked servers, for example: SELECT Column FROM [LinkedServer].DatabaseName.dbo.Table WITH(NOLOCK) But I couldn't find a way to make intellisense show results as I write SQL code (it works fine with non-linked servers) Things I've tried: Look for answers in SQLSMS docs. Look for specific config option in the application. Update local cache in Edit -> IntelliSense -> Refresh local

Inserted Id in linked SQL Server

末鹿安然 提交于 2020-04-30 17:02:42
问题 I have linked together 2 Microsoft SQL servers, let's call them LinkedServer1 and Server2. I am trying to insert data from the second one using an INSERT script with OUTPUT to obtain the auto-incremented id: DECLARE @newIdHolderTable TABLE (Id INT) INSERT INTO [LinkedServer1].[Db1].[dbo].[Table1] (Field1 ,Field2) OUTPUT inserted.ID INTO @newIdHolderTable SELECT Field1 ,Field2 FROM [Server2].[Db1].[dbo].[Table1] WHERE [Id] = @Id Unfortunately this fails with an error message: A remote table

Inserted Id in linked SQL Server

≯℡__Kan透↙ 提交于 2020-04-30 17:00:28
问题 I have linked together 2 Microsoft SQL servers, let's call them LinkedServer1 and Server2. I am trying to insert data from the second one using an INSERT script with OUTPUT to obtain the auto-incremented id: DECLARE @newIdHolderTable TABLE (Id INT) INSERT INTO [LinkedServer1].[Db1].[dbo].[Table1] (Field1 ,Field2) OUTPUT inserted.ID INTO @newIdHolderTable SELECT Field1 ,Field2 FROM [Server2].[Db1].[dbo].[Table1] WHERE [Id] = @Id Unfortunately this fails with an error message: A remote table

Inserted Id in linked SQL Server

Deadly 提交于 2020-04-30 17:00:12
问题 I have linked together 2 Microsoft SQL servers, let's call them LinkedServer1 and Server2. I am trying to insert data from the second one using an INSERT script with OUTPUT to obtain the auto-incremented id: DECLARE @newIdHolderTable TABLE (Id INT) INSERT INTO [LinkedServer1].[Db1].[dbo].[Table1] (Field1 ,Field2) OUTPUT inserted.ID INTO @newIdHolderTable SELECT Field1 ,Field2 FROM [Server2].[Db1].[dbo].[Table1] WHERE [Id] = @Id Unfortunately this fails with an error message: A remote table

Import EXCEL data to SQL Server without data conversion

℡╲_俬逩灬. 提交于 2020-01-24 01:31:06
问题 I am trying to insert excel data into sql server tables. Each column should be imported with the exact same format that the user wrote in the source Excel. I am using following query to fetch data SELECT * FROM OPENROWSET( 'Microsoft.ACE.OLEDB.12.0', 'Excel 12.0 Xml;HDR=YES;IMEX=1;Database=H:\Loadloandata\Test\K3.xlsx', 'SELECT * FROM [Sheet1$]') But now in the date column of excel we are receiving some float values( format issues from the users) as shown below Because of the invalid data,

catastrophic failure trying to select from linked server

落爺英雄遲暮 提交于 2020-01-14 07:15:32
问题 I have created a linked oledb/odbc connection to Pervasive SQL from SQL SERVER 2012: USE [master] GO /****** Object: LinkedServer [KSLAP208] Script Date: 2/8/2013 10:38:55 AM ******/ EXEC master.dbo.sp_addlinkedserver @server = N'KSLAP208', @srvproduct=N'Pervasive ODBC Interface', @provider=N'MSDASQL', @datasrc=N'C003', @location=N'localhost' /* For security reasons the linked server remote logins password is changed with ######## */ EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'KSLAP208

Creating a Linked Server and Database Alias

情到浓时终转凉″ 提交于 2020-01-13 09:42:46
问题 I have two servers Server1 and Server2 On both servers i have a Database called QAI is there a way that i can create a linked server with an alias from Server2 to Server1 but instead of Server1.QAI.dbo.tbBlah Have it aliased as QAI.dbo.tbBlah This is needed due to the QAI DB on server2 failing and needing to fall back to the Server1 instance while it is fixed Thanks 回答1: This works. Tested on a SQL2012 http://alexpinsker.blogspot.se/2007/08/how-to-give-alias-to-sql-linked-server.html There

Can't create linked server - sql server and mysql

好久不见. 提交于 2020-01-11 10:54:32
问题 I want to create a linked server between SQL Server and a MySQL instance. I followed the steps outlined in this tutorial but it's not working. I've recorded a video of the process I am using to create the server: http://www.youtube.com/watch?v=-8psvDjysHk&feature=youtu.be SQL server return this error: The linked server has been created but failed a connection test. Do you want to keep the linked server? An exception occurred while executing a Transact-SQL statement or batch. (Microsoft

Can I join data from 2 different DB2 databases? (Like SQL Server linked databases)

萝らか妹 提交于 2020-01-11 05:04:09
问题 I'm enhancing an existing java application. There is data in 2 different DB2 databases. The app already gets data from 2 different databases, but it always does a lookup from one and then the other. Is there a way to join data from 2 different DB2 databases using one SQL SELECT? This is what I tried: CREATE ALIAS remote_orders FOR remote_db.schema.orders; select * from myid.remote_orders a inner join local_schema.parts b on (a.key = b.key) with ur FETCH FIRST 200 ROWS ONLY I get this error:

How can I connect to an external database from a sql statement or a stored procedure?

[亡魂溺海] 提交于 2020-01-10 02:50:12
问题 When running a SQL statement or a stored procedure on a database, can you connect to an external database and pull data from there? something like: SELECT a.UserID, b.DataIWantToGet FROM mydb.Users as a, externaldb.Data as b 回答1: You'll need to setup a Linked Server instance. Then you can reference the external database as though it were a SQL Server database. 回答2: Yep -- there's two methods: either use the function OPENROWSET , or use linked servers. OPENROWSET is useful for ad-hoc single