Questions tagged [openquery]

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.

421 questions
0
votes
1 answer

How to use openquery in c#

I have an openquery SQL script: Select * from openquery([oak],' SELECT LicenseKey, SUM(PaymentAmount)as Payments FROM vw_ODBC_actv_Payments pt WHERE MONTH(pt.EntryDate) = 2 and YEAR(pt.EntryDate) = 2015 GROUP BY LicenseKey ') When I run this from…
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
0
votes
0 answers

Format when passing a date parameter as string to oracle via openquery

I am moving a stored procedure from SQL Server 2005 to SS2008R2. I am using Openquery with date parameters. The 2008 Linked Server is configured with Oracle Provider for OLE DB. The relevant code looks like this: DECLARE @beginDate DATETIME …
emreimer
  • 71
  • 1
  • 1
  • 7
0
votes
1 answer

Update OpenQuery with parameters

UPDATE OPENQUERY Help I am trying to update an Oracle 11 table via a linked server in SQL, now the linked server and select statements all appear correct and I think I am very close to cracking this, but I am having issues with the update. The…
0
votes
0 answers

T-SQL : pass parameter to openquery stored procedure

I am trying to pass a @year parameter through SSRS to a SQL Server stored procedure that queries a Progress database. I am getting a syntax error at the @year value when the stored procedure runs in ssrs. Can anyone see something blindingly obvious…
0
votes
0 answers

SQL Server Linked Server : OLE DB provider 'MSDAORA' reported an error

I have an issues with linked server to Oracle... at first the server running SQL Servre 2000 and Oracle8i, and the linked server works well... But after IT Department installs an Oracle 11g Client on the server... When I execute my open query in SQL…
ajieh89
  • 53
  • 5
0
votes
2 answers

SQL Server : Openquery to Oracle: Data type for number/numeric

On a SQL Server 2012 SP2 I am using OPENQUERY to Oracle 9/10/11. In general I dealt with integers, now we have some OPENQUERY's which address floating numbers. The values are stored in columns with the data type number(). In SQL Servre the…
Joe Platano
  • 586
  • 1
  • 14
  • 27
0
votes
1 answer

Sybase server linked in SSMS using Concatenate in openquery

I have managed to link a Sybase server to SSMS and am able to query it using openquery but I get an error every time I try to concatenate columns. ie: Select * from openquery(SybaseServer, 'select top 1000 first_name + middle_name + Last_name as…
user3486773
  • 1,174
  • 3
  • 25
  • 50
0
votes
1 answer

T-SQL OPENQUERY to MySQL - Insert ID

I am using OPENQUERY to do an insert from MSSQL 2005 to MySQL. How do I get at the last inserted id on the MySQL db back into my MSSQL procedure?
Aditya T
  • 147
  • 3
  • 3
  • 14
0
votes
1 answer

Case-Sensitive Linked-Server merge script - Set IDENTITY_INSERT ON not working
I am doing a experimental script to do a SQL Comparison (COLLATED as case-sensitive) and I am having issues with the SET IDENTITY_INSERT
ON I have switched on this option and disabled foreign key checks, but it still seems to be complaining…
Eon
  • 3,833
  • 10
  • 46
  • 75
0
votes
1 answer

OPENQUERY throws error when used with WIN2K8\SQL2K12

I'm trying the following Sql query to move my stored procedure result into table SELECT * INTO #tmpTable FROM OPENQUERY(WIN2K8\SQL2K12, 'EXEC vcs_gauge @gauge_name=vs1_bag,@first_rec_time=2014-09-01 09:00:00,@last_rec_time=2014-09-01…
SRY_JAVA
  • 323
  • 3
  • 10
  • 21
0
votes
0 answers

Query Active Directory via SQL Server Linked Server on Trusted Domain Returns Error

I think a similar question posted HERE, but I am not sure if it is indeed the same solution for me. I have a SQL Server 2000 instance on the local domain, I can query it without error. But I need to query another active directory on a trusted…
user1633947
  • 149
  • 2
  • 12
0
votes
1 answer

Bad Data in linked table

I pull data to SQL Server from a cobol database that is connected as a linked server. we have ended up with bad data in one of our tables, and I am trying to track down the offending record. specifically we have a letter entered in to a year field,…
0
votes
1 answer

sql open query on active directory with multiple where clause

I'm trying to limit the results using more than one WHERE clause like it is done in .net such as search.Filter = ("(&(objectCategory=person)(physicaldeliveryofficename=*)) but in SQL with open query on linked server I have this and works fine…
Jorge
  • 13
  • 3
0
votes
1 answer

SQL with Active Directory and nested groups/users

i have one AD group that contains 5 users. 3 of the users are from the Domain1 and 2 are from a trusted Domain2 i have a problem getting the users from domain2 after i read out what users have access to what groups. I'm using openquery to adsi. …
Nils
  • 516
  • 3
  • 9
  • 33
0
votes
0 answers

SQL Server, How to loop Servers in OpenQuery?

I found lot of things very interesting on the website but not this one. I try to find an answer to my issue with OpenQuery, and I can't find it. Let me explain, the goal for me is to query lot of SQL Servers in my compagny throught OPENQUERY &…
Olivier
  • 1
  • 1