openquery

SELECT * FROM MySQL Linked Server using SQL Server without OpenQuery

删除回忆录丶 提交于 2019-12-20 10:34:22
问题 I am trying to query a MySQL linked server using SQL Server . The below query runs just fine. SELECT * FROM OPENQUERY([Linked_Server], 'SELECT * FROM Table_Name') Is it possible to run the same query without using the OpenQuery call? 回答1: Found the answer here. Now I can the three dot notation query. Thanks http://www.sparkalyn.com/2008/12/invalid-schema-error/ Go to the provider options screenIn SQL Server 2005 you can see the list of providers in a folder above the linked server (assuming

Wide varchar field causes “Requested conversion is not supported” error using openquery with MySQL linked server

时间秒杀一切 提交于 2019-12-20 02:39:10
问题 I'm trying to migrate a table from MySql to MSSQL using openquery but I keep getting the following error message: OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "Requested conversion is not supported.". Msg 7341, Level 16, State 2, Line 1 Cannot get the current row value of column "[MSDASQL].description" from OLE DB provider "MSDASQL" for linked server "MYSQL". The SQL query I'm trying to run: insert into dbo.tickets (id, description, createdAt) select * from openquery

Querying an Oracle database from SQL Server

安稳与你 提交于 2019-12-19 03:21:35
问题 I have an Oracle 11g XE database that I would like to transfer into SQL Server Express 2005. At first I thought I'd just generate the tables in Oracle as SQL, manipulate the data formats, and run the query in SQL Server. This worked for small tables, but I have several tables with a few hundred thousands rows and some with millions of rows, so this solution won't work. I then created a TNS file with the following content: OracleTnsName = ( DESCRIPTION= ( ADDRESS = (PROTOCOL=TCP)(HOST

Querying an Oracle database from SQL Server

我怕爱的太早我们不能终老 提交于 2019-12-19 03:20:35
问题 I have an Oracle 11g XE database that I would like to transfer into SQL Server Express 2005. At first I thought I'd just generate the tables in Oracle as SQL, manipulate the data formats, and run the query in SQL Server. This worked for small tables, but I have several tables with a few hundred thousands rows and some with millions of rows, so this solution won't work. I then created a TNS file with the following content: OracleTnsName = ( DESCRIPTION= ( ADDRESS = (PROTOCOL=TCP)(HOST

How to join linked server table and sql server table while using openquery

◇◆丶佛笑我妖孽 提交于 2019-12-19 03:09:54
问题 I use openquery syntax to read the data from a linked server. SELECT * FROM OPENQUERY(LinkServer, 'SELECT * FROM Product') I want to join this link server table with an Sql server table to get my final results. For now I do it by, having a temp table. SELECT * INTO #Temp_Products FROM OPENQUERY(TREPO, 'SELECT ID, Name FROM Products') SELECT * FROM #TEMP_PRODUCTS A INNER JOIN ORDERED_PRODUCTS B ON A.ID = B.ID But as the link server product table contains huge records, it takes time to get

Using OPENQUERY (exec stored procedure) to create new temporary table fails with error 11526

拈花ヽ惹草 提交于 2019-12-17 16:46:18
问题 I have SQL Server 2012 full version installed on my development PC. I am trying to follow the examples here, which show how to create a new temporary table using a stored procedure as the source of the data. I am trying to combine the results of several stored procedures into a single temporary table (the column-structure/definition of the various resultsets is identical). To test if the plumbing is working, I issue this query: SELECT * FROM OPENQUERY("FOO\SQL2012", 'exec mySchema

including parameters in OPENQUERY

时光怂恿深爱的人放手 提交于 2019-12-16 23:58:13
问题 How can I use a parameter inside sql openquery, such as: SELECT * FROM OPENQUERY([NameOfLinkedSERVER], 'SELECT * FROM TABLENAME where field1=@someParameter') T1 INNER JOIN MYSQLSERVER.DATABASE.DBO.TABLENAME T2 ON T1.PK = T2.PK 回答1: From the OPENQUERY documentation it states that: OPENQUERY does not accept variables for its arguments. See this article for a workaround. UPDATE: As suggested, I'm including the recommendations from the article below. Pass Basic Values When the basic Transact-SQL

including parameters in OPENQUERY

陌路散爱 提交于 2019-12-16 23:56:10
问题 How can I use a parameter inside sql openquery, such as: SELECT * FROM OPENQUERY([NameOfLinkedSERVER], 'SELECT * FROM TABLENAME where field1=@someParameter') T1 INNER JOIN MYSQLSERVER.DATABASE.DBO.TABLENAME T2 ON T1.PK = T2.PK 回答1: From the OPENQUERY documentation it states that: OPENQUERY does not accept variables for its arguments. See this article for a workaround. UPDATE: As suggested, I'm including the recommendations from the article below. Pass Basic Values When the basic Transact-SQL

Error trying to Select x rows from DB2 (V4R5M0) via sql server linked server using OPENQUERY

爷,独闯天下 提交于 2019-12-12 18:06:18
问题 I have a Linked Server from SQL Server 2008 R2, to a DB2 Database (V4R5M0) using OLE DB provider "IBMDA400" Linked Server Detials EXEC master.dbo.sp_addlinkedserver @server = N'JTEST', @srvproduct=N'IBM OLE DB Provider for DB2', @provider=N'IBMDA400', @datasrc=N'TestName' This works fine: SELECT * FROM OPENQUERY(JTEST, 'Select * from QSYS2.SYSCOLUMNS') But the following statement produces an error: SELECT * FROM OPENQUERY(JTEST, 'Select * from QSYS2.SYSCOLUMNS FETCH FIRST 10 ROWS ONLY') Error

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