linked-server

How to get the result sets from tsql's execute?

蹲街弑〆低调 提交于 2019-12-12 01:54:58
问题 I try to remotely query table-valued function as it is offered in this SO answer. But I stumbled over how to get the returned result sets to further work with them in sql code... Calling UDF remotely is not supported by SQL Server and openquery cannot have parameters - only static string. declare @query nvarchar(max) = 'select * into #workingDays from openquery(LNKDSRV, ''select * from DB.dbo.fxn_getWorkingDays(''''' + cast(@date1 as nvarchar(max)) + ''''',''''' + cast(@date2 as nvarchar(max)

SSIS Ole DB Source as Stored procedure from linked server with parameters

左心房为你撑大大i 提交于 2019-12-12 00:00:56
问题 all. I am using stored procedures from linked server. I want to use the procedure in ole db source. I wrote the query, which works in SSIS. select ID, LAST_NAME_ENG, LAST_NAME_G, FST_NAME_ENG, FST_NAME_G, BIRTHDATE from openquery (linkedserver, 'exec [linkedserver].get_records @SESSION_ID = 12 , @SYSTEM = ''oCRM'', @ENTITY_NAME = ''CLIENT'' WITH RESULT SETS (([ID] [int] NOT NULL, [LAST_NAME_ENG] [varchar](50) NOT NULL, [LAST_NAME_G] [varchar](50) NOT NULL, [FST_NAME_ENG] [varchar](50) NOT

Archiving data between linked servers - transaction issue

北城以北 提交于 2019-12-11 23:49:36
问题 Trying to archive some data from one database table to another over linked server connection. So far have gotten fairly close however getting a puzzling transaction exception currently. Here's the T-SQL: USE ArchiveDatabase -- Declare date we are archiving to DECLARE @ArchiveDate DATETIME SET @ArchiveDate = DATEADD(MONTH, -2, GETDATE()) -- Create temp table CREATE TABLE #DeleteIDs (ID int) -- Continue looping while rows exist WHILE EXISTS (SELECT TOP 1 * FROM [LINKEDSERVER].MasterDatabase.dbo

SQL Server passing tables Netezza

假装没事ソ 提交于 2019-12-11 22:08:55
问题 Just wondering what is best practice to achieve: We have stored procedure that runs in SQL Server and needs to do some calculations with a huge fact table to be stored on Netezza. The flow: Stored procedure will create temp tables on SQL Server These will be sent to Netezza to be joined with the fact table Calculations will be made in Netezza Results will be passed back to SQL Server What are the ways to pass the temp tables from SQL Server to Netezza? Thanks 回答1: The Only way that I know of

Catching Errors through a linked server with severity < 20

一笑奈何 提交于 2019-12-11 20:18:09
问题 I've got a similar problem to this question: TRY CATCH with Linked Server in SQL Server 2005 Not Working I'm running this try catch: Declare @command nvarchar(100) SET @command = 'SELECT column FROM table' BEGIN TRY BEGIN TRY exec ' + @Server_Name + @DB_name + '.dbo.sp_executesql @command END TRY BEGIN CATCH PRINT EXCEPTION END CATCH I don't think I can use RAISEERROR because I'm not running my own stored procedure, I'm only running a simple select statement. I've tried using @@ERROR but that

How to make your Server as Linked Server for selected views?

天大地大妈咪最大 提交于 2019-12-11 15:16:52
问题 We have a SQL Server 2012 instance which is the database for our security system. Now we have a scenario where we want to allow another team our SQL Server to select certain records, ie we created four views for them for their requirements. But, we don't want to provide or list all our tables to them but only allow these four views to see and query in our system. As I go through many documents it's clear that we can do it through making our SQL Server as a linked server. What's the best way

can't query SQL linked server -> MS Access remotely, only works on server

我是研究僧i 提交于 2019-12-11 12:36:04
问题 I'm working on a C# application that queries a SQL Server 2008 Express instance on a remote server (LAN). When I am at my workstation/dev machine, I can open SQL Server Management Studio and connect to the SQL instance through Windows Authentication, and for all intents and purposes the experience is identical to working in SSMS "on" the server. As far as I can tell, I can do anything from my workstation that I'd be able to do on the server. That same server hosts an Access 2003 .mdb file,

how to make foreign key relationship on physically distributed data?

南笙酒味 提交于 2019-12-11 12:18:29
问题 three servers server 1 is central point which links the other two servers. the other two servers have a table which has a field which should act like a foreign key problem well i do not know how to do this, using vs08 or sql server 08 diagram view table on server 1 sv1pg1 id -- primary key details tables same schema on srvr2 and srvr3 linkedSRVid -- pk linkedto -- fk constrain should be between (server 1 primary key and this field) note that "this is just a simplest! way i can think of to

SQL server timeout 2000 from C# .NET

我是研究僧i 提交于 2019-12-11 11:41:30
问题 I have run into a strange problem using SQL Server 2000 and two linked server. For two years now our solution has run without a hitch, but suddenly yesterday a query synchronizing data from one of the databases to the other started timing out. I connect to a server in the production network, which is linked to a server containing orders I need data from. The query contains a few joins, but basically this summarizes what is done: INSERT INTO ProductionDataCache (column1, column2, ...) SELECT

Configuring mysql linked server with db2

丶灬走出姿态 提交于 2019-12-11 10:12:14
问题 I have two database server one is mysql another is db2 both are running on different machine.I want to fetch records from tables from both the database by using a join.i have studied about linked server concept but the problem is i couldnt find any example for creating a linked server with db2(all i can find is SSMS i.e use Sql Server Mannagement Studio for creating linked server) but mine is case is of mysql and db2 and i need to create a linked server to one of them/vice versa. Please