OPENQUERY is a T-SQL function that allows for executing a pass-through query on a linked server. The linked server should be an OLE DB data source. OPENQUERY is used in SELECT, INSERT, DELETE and UPDATE statements as if it were a table name.
Questions tagged [openquery]
421 questions
0
votes
1 answer
SQL OpenQuery linked server Oracle DateAdd
I am writing a sql query to pull some data from one of our linked oracle servers.
The only problem with this query is with the two date add rows (with them removed the query runs) but i need their data.
I receive the below error:
OLE DB provider…

Will
- 228
- 1
- 2
- 15
0
votes
1 answer
Sql server linked server to Oracle return ??? instead of chars
I am using Oracle 11g and Sql Server 2008 R2
In the sql Server i have a linked server connected to the Oracle machine.
In the Sql Server I am using openquery to select from a table in the Oracle.
Whenever there are char columns in the Oracle i get…

alonk
- 101
0
votes
1 answer
openquery apears to be rolled back when done
I'm using the following query.
select * from OPENQUERY(EXITWEB,N'SET NOCOUNT ON;
declare @result table (id int);
insert into [system_files] ([is_public], [file_name], [file_size], [content_type],…

Tschallacka
- 27,901
- 14
- 88
- 133
0
votes
1 answer
Progress Providex database openquery SQL error
I get this error when I do a openquery select to a linked server using an providex odbc driver. The database I am trying to connect to is built on Progress.
Cannot get the current row value of column "[MSDASQL].IVD_PRICE" from OLE DB provider…

tdinh
- 1
0
votes
0 answers
List of users in all active directory groups within a company (150k users)
My goal is:
I have to get information straight from AD server about all users in all active directory non empty groups(mail, account name, full name). i Have to put it into my Active Directory Database prepared for it. I want to have a SSIS package…

odrzyja0
- 103
- 1
- 9
0
votes
1 answer
How to swap in a parameter for a specific VARCHAR value being used for a linked server with openquery
When I execute this query(it's a scalar function) I get the result I want. It returns a shipping number.
select ShipmentNo from openquery([SERVER_IP], 'SET FMTONLY OFF EXEC GsvStaging.dbo.Paul_GetPoShippingLabels @CartId = NULL, @CpPoNo =…

user1869407
- 227
- 3
- 19
0
votes
1 answer
SQL Server 2008 OPENQUERY inside sp_executesql. Getting error incorrect syntax?
Code:
DECLARE @resultLast int, @siparisID nvarchar(21)
SET @siparisID = 2487
EXEC sp_executesql N'select * from OPENQUERY([MYSERVER],''Select ( [MYDB].[dbo].[FN_SIPARIS_YUKLEME_TUTARI](@siparisID , 20 ,
…

Murat KARATEPE
- 3
- 2
0
votes
0 answers
Update table in Database through linked server
I want to update my TableA on my ServerA by using linked server which is on serverB.I have successfully created the linked server but i am a little bit confused.
Actually i have to update a columnA of TableA from the data coming from columnB(TableB)…

Hussain Ahmad
- 13
- 1
- 5
0
votes
1 answer
SSIS Ole DB Source as Stored procedure from linked server with parameters
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…

Yuriy D
- 95
- 1
- 9
0
votes
1 answer
OpenQuery or Create Duplicate Database on 2 different servers?
okay so I googled quite a bit and didn't find an answer, so here I am.
I have two servers, Lets say Server1 and Server2.
Server1 has 1 database S1.DB1.
Server 2 has 2 databases S2.DB1 and S2.DB2.
Now, I have to do reporting on Server 1 where I need…

Dhruv Malik
- 3
- 2
0
votes
3 answers
Why wont this query work
I have the following SQL openquery
SELECT @TSQL = 'SELECT * FROM OPENQUERY(RMSPROD2,''SELECT COUNT(DISTINCT W.Bond) AS NoBID_Count
FROM TIB.WRMAST w
…

Perry
- 1,277
- 2
- 17
- 39
0
votes
1 answer
Error /w OPENQUERY access error in SQL Server create procedure. Possible to create anyway?
Basic idea is I need to create a procedure, but I don't have access to the OPENQUERY linked server table so it errors out stating user does not have SELECT access. The idea is I'm trying to create the stored procedure and will have someone who does…

Dulanic
- 67
- 1
- 6
0
votes
1 answer
Using Parameters in OPENQUERY
I have linked server connection named MMSHO. There is a parameterized function in Oracle server where I want to send store codes by OPENQUERY then filter in where condition. :
DECLARE
@OPENQUERY NVARCHAR (MAX),
@STOREID VARCHAR…

Oğuz Çelikdemir
- 4,990
- 4
- 30
- 56
0
votes
1 answer
SQL Oracle openquery to get items and location of items
I am using an openquery to an Oracle server to get information from BaaN ERP.
My request is to get the information of an item and all the locations where the item has stock, and show the information in a gridview, as you can see in the attached…
user6137247
0
votes
1 answer
SQL Server DELETE OPENQUERY performance
We have a series of programs that are designed to move data from one SQL Server database into another using OPENQUERY and database linked servers.
We are noticing that queries such as the following are taking orders magnitude long than…

Naros
- 19,928
- 3
- 41
- 71