OPENQUERY , OPENROWSET
Trying to run a query against an Oracle server using OpenQuery and/or OpenRowSet.
Using the following query and getting "SQL Command not properly ended" with either OpenQuery or OpenRowSet.
SQL
Select * FROM OPENROWSET('MSDAORA', 'LINKDV', 'SENDD', 'yamaha', ' select DISTINCT PB_Preflight.Deal_number, PB_Preflight.job_number, PB_Preflight.cycle_number, generic_cycle.Status_code, generic_cycle.Date_created, generic_cycle.Date_Modified, generic_cycle.Date_into_manufctng, generic_cycle.Date_due_to_Client, generic_cycle.date_complete_by, generic_cycle.site_id_mfg, generic_cycle.site_id_created, generic_cycle.Service_Level_type, SENDD.V_PB_CUST_REQS.Print_status, deal.name as deal_name, site.Name_short, market_segment.MARKET_CATEGORY, deal.site_id as deal_site_id, job.site_id as job_site_id, SENDD.V_PB_CUST_REQS.transfer_request From PB_Preflight, generic_cycle, SENDD.V_PB_CUST_REQS, deal, job, site, market_segment Where PB_Preflight.DEAL_NUMBER = generic_cycle.DEAL_NUMBER and PB_Preflight.JOB_NUMBER = generic_cycle.JOB_NUMBER and PB_Preflight.cycle_number = generic_cycle.cycle_number and SENDD.V_PB_CUST_REQS.deal_number = generic_cycle.deal_number and SENDD.V_PB_CUST_REQS.job_number = generic_cycle.job_number and SENDD.V_PB_CUST_REQS.cycle_number = generic_cycle.cycle_number and job.deal_number = generic_cycle.deal_number and job.job_number = generic_cycle.job_number and generic_cycle.SITE_ID_MFG = site.site_id and deal.deal_number = generic_cycle.deal_number and deal.MARKET_SEGMENT_ID = market_segment.MARKET_SEGMENT_ID and (GENERIC_CYCLE.Date_Modified >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'') or GENERIC_CYCLE.Date_created >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'') or deal.Date_Modified >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'') or deal.Date_created >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'') or job.Date_Modified >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'') or PB_Preflight.last_mod_date >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'') or PB_Preflight.create_date >= to_date (''26-Aug-2000 03:50:12'',''dd-mon-yyyyhh24:MI:SS'')) ')
Any suggestions would be greatly appreciated!
Probably those double quotes you're using. A better solution would be to convert those strings to coldfusion datetime variables and use cfqueryparam.
Similar Messages
-
MSOALP openquery slower on local than on another server
Hi,
We are using SQL server 2008R2 64bit.
I have an MDX query which executes within 7 seconds (Profiler 'Query End' - duration = 7288) by using the SSMS MDXquery window. The resultset contains +70000 rows, and is finished into the result window within less than 20 seconds.
I want to transform these results into a SQL stored procedure. So I use a linked server to connect the OLAP server (@srvproduct=N'OLAP', @provider=N'MSOLAP', @datasrc=N'localhost'), and execute the MDX by making use of this linked server:
SET @SQL='SELECT * FROM OPENQUERY(OLAP_srv, '''+REPLACE(@MDX,'''','''''')+''')'
EXEC sp_executeSQL @SQL
However when I execute the MDX from the 'local' OLTP engine, the profiler (SSAS side) shows again 7 seconds for the 'Query End', but the result only returns after nearly 2 minutes. Also the profiler shows: 'Audit Logout' - Duration
= 117577 ms.
I have tried this from another OLTP server and on that server it returns within 1 minute.
When I look with the profiler (SQL side), it are the 'OLEDB DataRead'
events which are slower.
OPENQUERY and OPENROWSET have the same results.
Any idea what’s the reason? Why is it slower on the local SQL server, from local OLAP to local OLTP?
Thanks.
Eric.Hi Eric,
Thank you for your question. I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
Thank you for your understanding and support.
If you have any feedback on our support, please click
here.
Regards,
Elvis Long
TechNet Community Support -
Hi,
Can anyone help me out please.
I have written one stored Procedure to create a views using Openrowset(openquery) but for tables which contains xml data types throwing error while executing the SP. Error
" Xml data type is not supported in distributed queries. Remote object 'OPENROWSET' has xml column(s)."
Please refer the Stored Procedure & error message below.
USE [Ice]
GO
/****** Object: StoredProcedure [dbo].[Pr_DBAccess] Script Date: 08/14/2014 16:08:20 ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
ALTER
PROCEDURE [dbo].[ Pr_DBAccess](@SERVERTYPE
NVARCHAR(50),@SERVERNAME
NVARCHAR(100),@DATABASENAME
NVARCHAR(100),@SCHEMANAME
NVARCHAR(100),@TABLENAME
NVARCHAR(100),@USERNAME
NVARCHAR(100),@PASSWORD
NVARCHAR(100))
AS
BEGIN
DECLARE @openquery
NVARCHAR(4000),
@ETL_CONFIG_IDN
NVARCHAR(100);
IF @SERVERTYPE='SQL'
BEGIN
SET @openquery=
'CREATE VIEW '+@TABLENAME+
' WITH ENCRYPTION AS SELECT * FROM OPENROWSET(''SQLNCLI'',''SERVER='+@SERVERNAME+';TRUSTED_CONNECTION=YES;'',''SELECT * FROM '+@DATABASENAME+'.'+@SCHEMANAME+'.'+@TABLENAME+''')'
SELECT @openquery
END
EXECUTE
sp_executesql @openquery
END
----While running the SP manually below error occuredHI ,
1. You cannot use a table or view that contains xml or clr type as 4-part name in your query
2. You need to cast the column to either nvarchar(max) or varbinary(max) or other appropriate type to use
3. If you have a table that has xml type for example then you need to create a view that contains all columns other than xml and query it instead. Or you can issue a pass-through query using OPEN QUERY with the appropriate columns only.
Here is a work around:
SELECT
Cast(a.XML_Data as XML) as XML_Data
FROM
OPENQUERY([LINKED SERVER NAME HERE],'
SELECT
Cast(XML_Data as Varchar) as XML_Data
FROM
[DATABASE NAME].[SCHEMA].[TABLE NAME]'
) a
Basically, the data is queried on the remote server, converts the XML data to a varchar, sends the data to the requesting server and then reconverts it back to XML.
You can take help from below link;
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c6e0f4da-821f-4ba2-9b01-c141744076ef/xml-data-type-not-supported-in-distributed-queries?forum=transactsql
Thanks -
SCHEMABINDING error while using with OPENQUERY
I have a linked server called D20LS and trying to create a view on which pulls the data from the linked server using OpenQuery as shown.
(Environment is SQL Server 2012 and Linked Server is pointing to ODBC drivers)
create view vClaim
WITH SCHEMABINDING
as
SELECT clientid
,clientsubid
,claimnumber
FROM OpenQuery(D20LS, 'SELECT clientid, clientsubid, claimnumber FROM claim')
It is giving the error as
Msg 1054, Level 15, State 3, Procedure vClaim, Line 18
Syntax 'Openrowset/Openquery/Opendatasource' is not allowed in schema-bound objects.
Please let me know is there any workaround for this.
Thanks in advance
RajaThe workaround is to not use SCHEMABINDING when you use OPENQUERY or in other ways accesses data in other databases or servers.
SCHEMABINDING means that you tell SQL Server not to permit any changes that would cause your view to fail. But there is no way that SQL Server can prevent the admin of D20LS (which for all I care could be Oracle, MySQL or whateever) to drop the table claim
or a column in that table.
Erland Sommarskog, SQL Server MVP, [email protected] -
Hi guys,
I'm trying to run this query on my machine remotely accessing our database using ssms. My laptop is 64 bit.
"select * from OpenRowset('Microsoft.Jet.OLEDB.4.0','Excel 8.0; IMEX=1;Database=\\192.162.1.13\data\data.xls', 'select * from [data$]' )"
but I'm getting this error:
"Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.JET.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.JET.OLEDB.4.0" for linked server "(null)".
**It executed successfully when I run it on our database server.
Database server is 32 bit.
Excel version I'm trying to import is 2003.
Any ideas why I'm getting the error when I run it on my machine?
Thank you in advance for your help!Hello,
If the Windows account you are logged in on that laptop is the same Windows account used to start SQL Server service, and that Windows account has read permissions (at least) on the network path you will be able to read the Excel file.
You can either login as the service account and run the query or change the SQL Server service account to the Windows account you are
logged in right now.
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
How to create a view on SQLServer 2008 as an OPENQuery select to a MYSQL linked server
I am trying to create a view on SQLServer through Management Studio based on data on a MYSql server.
I have created the Linked server and I am able to query all data.
Using the syntax select * from OPENQUERY (linkedServer, 'select * from MYSQL-table') - This works fine
What I am trying to do now is issue the following statement
create view ViewnameToBeCreatedOnSQLServer
as select * from OPENQUERY (linkedServer, 'select * from MYSQL-table')
When I run this from SSMS I get the following error
OLE DB provider "MSDASQL" for linked server "TESTTSC2" returned message "[MySQL][ODBC 5.1 Driver][mysqld-5.0.95-log]Table 'FP.M3' doesn't exist".
Msg 7350, Level 16, State 2, Procedure FPMaster3, Line 2
Cannot get the column information from OLE DB provider "MSDASQL" for linked server "TESTTSC2".
The account I am using has create view privs and alter schema privs on the SQlServer side. I am assuming there are not isues on the MYSQL server side since I am able to successfully run the select statement using OPENQUERY. There must be one small
piece I am missing. has anyone experienced the same problem and were you able to find a solution?All the configurations seem to be in place correctly since I can SELECT any data with no issues. The statement
select * from OPENQUERY (linkedServer, 'select * from MYSQL-table')
works fine and I can change the table I am selecting from which all return data. Therefore, the objects all exists in MYSQL.
The DSN is set up, the linked Server is good, the provider is set up, the DB account has all privs.
It only fails when I try to create the view on SQLServer as a select from a remote table accessed via the linked MYSQL server. I connect to SQLServer with DB account PS which has full privs including CREATE VIEW and ALTER SCHEMA. The MYSQL pass-through account
has read access to all objects in the MYSQL schema. I am trying to figure out if I might be missing some little part of this puzzle when trying to create a new object (CRESTE VIEW) vs. just reading the data (SELECT).
The kicker in all this is that I did create a view on SQLServer in this manner about a year ago and I am able to see the view definition and that view still works! So, this is quite interesting that I am not able to create a new object.
If there any specific information I could provide which might help, I am happy to do that. Just did not want to provide the details on all of the puzzle pieces if it can be avoided but if it comes to that then that's OK also.
Thanks very much! I appreciate your help. -
PREDICTION JOIN OPENQUERY against data source view does not work
Hi,
I am trying to follow the example in this link:
http://technet.microsoft.com/en-us/library/ms132031.aspx
to do a prediction join with a table defined in a data source view of our cube/mining structures. No matter how I specify the table in the OPENQUERY statement I get: "OLE DB error: OLE DB or ODBC error: Invalid object name 'DataSourceView.dbo.TableName'.;
42S02." I've tried specifying the table name in 1, 2, and 3 parts, with and without the '[]' brackets but get the same error every time. I thought something might be wrong with the table in the DSV so tried putting other tables in the query,
but that produces the same error. Any ideas on the problem?
SELECT FLATTENED
t.[Column1],
t.[Column2],
t.[Column3],
PredictTimeSeries([ModelName].[Column3],5)
From
[ModelName]
PREDICTION JOIN
OPENQUERY([DataSourceView],
'SELECT
[Column1],
[Column2],
[Column3]
FROM
[DataSourceView].[dbo].[TableName]
') AS t
ON
[ModelName].[Column3] = t.[Column3]
OLE DB error: OLE DB or ODBC error: Invalid object name 'R Staging.dbo.TestSet'.; 42S02."I want to be able to query a data source view table/named query. This TechNet article seems to imply it is as simple as running the following in a DMX window:
OPENQUERY ([MyDatasourceView],'select Column1 from DataSourceTable')
I've also tried:
select * from OPENQUERY ([MyDatasourceView],'select Column1 from DataSourceTable')
Both result in:
"Query (1, 1) Parser: The syntax for 'OPENQUERY' is incorrect."
Can we query a DSV table from a DMX query directly with OPENQUERY, or does the OPENQUERY only work within a PREDICTION JOIN? Seems like such a simple case for it not to work.
Following the example in this article:
http://technet.microsoft.com/en-us/library/ms132173.aspx -
Error: An error occurred while preparing the query in openquery on ServiceNow ODBC Link Server
Hi Team,
Greetings of the Day!!!!!
I have a created a link server on SQL Server 2008 R2 databse of Service Now ODBC driver. And written a stored procedure using openquery to get the data from link server.
Now problem is that, when i have scheduled that stored procedure in sql jobs. When this job runs automatically then we are getting below error while when i start the job mannually then it's not giving error.
An error occurred while preparing the query "..........."
Please help me to resolve this issue.
Regards,
Brijendra PandeyHi Fanny,
I had reviewed the job history. I am getting below message where as table is exist in the database.
Message
Executed as user: NT AUTHORITY\SYSTEM. OLE DB provider "MSDASQL" for linked server "SNOWDSN" returned message "[DataDirect][ODBC OpenAccess SDK driver][OpenAccess SDK SQL Engine]Base table:incident not found.[10129]". [SQLSTATE 01000] (Message 7412) OLE
DB provider "MSDASQL" for linked server "SNOWDSN" returned message "[DataDirect][ODBC OpenAccess SDK driver][OpenAccess SDK SQL Engine]Base table:sysapproval_approver not found.[10129]". [SQLSTATE 01000] (Message 7412) OLE DB provider "MSDASQL" for linked
server "SNOWDSN" returned message "[DataDirect][ODBC OpenAccess SDK driver][OpenAccess SDK SQL Engine]Base table:problem not found.[10129]". [SQLSTATE 01000] (Message 7412). The step succeeded.
Regards,
Brijendra Pandey -
Hello
I have the following query to a linked table but the variable will not work. I cannot get the correct syntax to enable the variable to to be used in the WHERE clause.
DECLARE @DT as DATETIME
SET @DT = (SELECT MAX(C.CallTime) AS Max_Time
FROM HL_CRM.dbo.connio_data1 AS C)
SELECT *
FROM OPENQUERY (CONNIO, 'SELECT *
FROM connio_advisor_data WHERE CallTime >= ''@DT''')
Please can you help?
Thankstry like this
DECLARE @TSQL varchar(8000), @VAR char(2)
SELECT @VAR = 'ST'
SELECT @TSQL = 'select * from openquery(IBMP,''select * from f4211 where sddcto=''''' + @VAR + ''''''')'
EXEC (@TSQL)
DECLARE @DT as DATETIME
SET @DT = (SELECT MAX(C.CallTime) AS Max_Time
FROM HL_CRM.dbo.connio_data1 AS C)
DECLARE @TSQL varchar(8000)
SET @TSQL='SELECT *
FROM OPENQUERY (CONNIO, ''SELECT *
FROM connio_advisor_data WHERE CallTime >= '''''+@DT+''''''')'
EXEC(@TSQL)
--Prashanth -
Oracle returns ORA-03113 EOF error when using openquery in SQLServer 2005
Hi
Our Application runs batch process on every moring . One of jobs is to get all rows from an oracle database and put all data into MS Sql Server Tables. Usally It works fine But Sometimes during getting data from a certain table oracle raise Ora-03113 error during
getting data from MSSQL Server. we use mssql openquery clause to get data from oracle We just use OPENQUERY to get all data of oracle view( i.e Select * FROM OPENQUERY(LINKEDORACLESERVER , "SELECT * FROM SCV0XE") )
This Error comes once a month. So I don't have any idea why this error happens. I am using MSSQL 2005 SP2 , Oracle 9i 9.2.01
And I tested both microsoft provider and oracle ole provider. Both Driver failed
Any Solution or Advice will be appreciated...
Regards,
ParkHi bborie :
I think I encounter same problem as you, I schedule a job of MS SSIS to do data transfer from Oracle to MS sqlserver every morning. Bt MS SQL server report "ORA-03113 : end-of-file on communication channel error ".
And Oracle alertlog report "inbound connection timed out (ORA-3136)"
sqlnet.log list "TNS-12535: TNS:operation timed out"
does your problem solved ? -
Query Time out option in OpenRowSet
Team,
My requirement is to loop through around 100 SSAS Instances and run an MDX query and get response from SQL Server.
To achive this , I used openrowset solutions
SET @sqlquery =N'SELECT @LastScanperiod = [[Measures]].[Last Scan Date Internal]]]
FROM OPENROWSET(''MSOLAP'', ''DATASOURCE=' + @CubeServername +';Initial Catalog=' + @CubeDBName +';Timeout=10''
,''SELECT {[Measures].[Last Scan Date Internal]} ON 0
FROM [' + @CubeName +']''
SET @params = N'@LastScanperiod INT output';
EXEC sp_executesql @sqlquery,@params,@LastScanperiod = @LastScanPeriodKey OUTPUT
But few of the servers might be down or may take longer time to respond. I would like to Timeout after a specified period of time instead of waiting until server responds. Even though I specified Timeout option as 10 sec , still
its not working. Any idea how to solve this?
Thanks,
PrathapReading about the connection-string properties for MSOLAP on
http://msdn.microsoft.com/en-us/library/dn140245.aspx
it appears that you should specify "Connect Timeout" rather than "Timeout". Timeout is the command timeout, that is for how long you permit a command to run once you are connected.
Erland Sommarskog, SQL Server MVP, [email protected] -
SSIS 2012 - Use OPENROWSET in SSMS and SSIS
HI Experts ,
I am getting very much confused with 64 bit ,31 bit environment in SQL server, SSIS and MS office , Accessdatabase engine
which I want to use for ETL as what should be the combination
My scenario - I have written an SP with OPENrowset to be used in EXECUTE SQL TASK and load data into SQL Table
example
SELECT * into myTable
FROM OPENROWSET (
'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=E:\SourceFolder\Department.xlsx;HDR=YES;IMEX=1',
'SELECT * FROM [Sheet1$]');
My SQL SERVER version is ::
Microsoft SQL Server 2012 - 11.0.2316.0 (X64)
Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
MS OFFICE 2010, 64 Bit
After executing
sp_configure 'show advanced options', 1;
RECONFIGURE;
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
My OPENROWset query Store Procedure is working fine in SSMS but when I executed Same SP in EXECUTE SQL TASK ,it failed .
Also I was not able to used Excel as a Source , I forgot the error but it did not even allowed me to select a sheet Name in Excel Source..
After doing bit of google I found that we need to have MS office 2010 in 32 bit because our BIDS is 32 Bit .
I asked my admin team to uninstall MS office 2010 64 bit and Install 32 bit version.
Now my versions are
SQL server 2012 , 64 bit
MS office 32 bit
Now
1) I am able to Take excel sheets as Source in SSIS Excel Source transformation but package fail
2) SP with OPENROWSET Query in which was running fine earlier in SSMS is also throwing error
3) and Execute SQL TASK with same SP in SSIS are throwing error ..
NOW I Installed AccessDatabaseEngine i.e. 32-bit but same issue
"The 32-bit OLE DB provider "Microsoft.ACE.OLEDB.12.0" cannot be loaded in-process on a 64-bit SQL Server"
PLEASE TELL ME THE COMBINATION .. I cannot reinstall SQL SERVER but definately MS OFFICE VERSION AND ACCESSdatabase engine version
I WANT
1) MY OPENROW SET QUERY CAN RUN BOTH IN SSMS and Execute SQL Task (SSIS).
2) I can use Excel as a Source in SSIS Package (with out making RUN64bitRUNTIME to FALSE )
PLEASE ASSISTHi Visakh ,
I might sound stupid asking almost same things again even after reading the Link but thing are not very clear with me and I am still getting an error while running
SELECT * --INTo productlist
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;HDR=YES;Database=D:\Mushtaq\ExcelS\Dept.xlsx',
'SELECT * FROM [S$]'
both IN SSMS and Execute SQL Task(Even after making Runas64bit to FALSE) ..
[Execute SQL Task] Error: Executing the query "SELECT *
INTO productlist
FROM OPENROWSET
('Micro..." failed with the following error:
"OLE DB provider 'Microsoft.ACE.OLEDB.12.0'
cannot be used for distributed queries because the provider is configured
to run in single-threaded apartment mode.".
Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
I have also executed below Query in SSMS but no luck:
USE [master]
GO
sp_configure 'show advanced options', 1
GO
RECONFIGURE WITH OverRide
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE WITH OverRide
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1
GO
But NOO Luck :(
I need to know what is wrong or missing in my Current environment to execute them in SSMS and SSIS
My Environment.
1)SQL SERVER 2012 64 Bit
2)MS office 32 Bit
3)MicrosoftAccessDataBase Engine 2010 -32 Bit ..
Please assist.. -
How can I use variables in an openquery?
below is my openquery. It works perfect but I need WOADAT range to be dynamic. How can I do that?
SELECT * FROM OPENQUERY(EPAK,
'SELECT WOADAT,WOROUT,BCDESC,WDWO#,BCSIZE,BCCHG
FROM CUST INNER JOIN (BCDE
INNER JOIN (WO2 INNER JOIN WO1
ON (WDCMP = WOCMP) AND (WDCUS# = WOCUS#) AND (WDWO# = WOWO#)) ON (BCCMPY = WDCMP)
AND (BCSIZE = WDSIZE) AND (BCCHG = WDCHG)) ON (CCMPNY = BCCMPY) AND (CCUST# = WDCUS#)
WHERE (((WOADAT) between 20140501 and 20140531) AND ((WDCMP)=''08''))order by WDWO#')
Any help will be greatly appreciated.
David,
Your statement returned me below error
OLE DB provider "IBMDA400" for linked server "EPAK" returned message "SQL0518: Prepared statement S000001 not found.
Cause . . . . . : An EXECUTE statement referred to the statement S000001. S000001 is not a valid prepared statement. The statement has one of the following conditions: -- The statement has never been prepared. -- The statement identifies
a prepared SELECT or DECLARE PROCEDURE statement. -- The statement was in error at prepare or bind time. -- The statement was prepared in another program or another call of this program and the program was created with CLOSQLCSR(*ENDPGM). -- The statement
was prepared in another module or another call of this module and the module was created with CLOSQLCSR(*ENDMOD). -- The statement was prepared in another call of this program and programs which have run SQL statements have ended and the program was created
with CLOSQLCSR(*ENDSQL). -- The statement was prepared in another call of this module and the activation group ended between calls. The module was created with CLOSQLCSR(*ENDACTGRP). -- The prepared statement was destroyed by a COMMIT or ROLLBACK statement.
This only occurs when connected to a database other than DB2 for IBM i. Recovery . . . : Do one of the following: -- If S000001 identifies a prepared SELECT or DECLARE PROCEDURE statement, a different prepared statement must be named in the EXECUTE
statement. -- If the statement had errors, correct the errors and either prepare the statement again or precompile the program again. -- Make certain that S000001 has been prepared in the same program or module call prior to using the EXECUTE statement or
specify either CLOSQLCSR(*ENDSQL), CLOSQLCSR(*ENDJOB), or CLOSQLCSR(*ENDACTGRP) when precompiling the application. -- If the statement was deleted by a COMMIT or ROLLBACK, either specify PREPARE WITH HOLD or bind the program with the correct option to preserve
prepared statements.".
Msg 7215, Level 17, State 1, Line 19
Could not execute statement on remote server 'EPAK'. -
Query on text file using Openrowset in Sql server 2012
Hi,
I am using below query on Sql server 2008 and sql server 2012.It is working find in 2008 but giving error in 2012.
below is query and error on sql 2012
select * from OpenRowset('MSDASQL', 'Driver={Microsoft Access Text Driver (*.txt, *.csv)};DefaultDir=D:\MSSQL;',
'select * from employee1.txt')
OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)".
I have read some document on msdn and install microsoft access database engine 2010, but still it not working.
Can anyone suggest resolution of this problem.
Thanks
Shitalkumar kasliwalRead this link
http://calyansql.blogspot.co.il/2013/02/fix-cannot-initialize-data-source.html
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Update openquery remote table with join
Hi All,
I have a problem with OPENQUERY update on remote table. I've googled for days, and can't solve the problem.
Here is the problem:
Local server MS SQL 2005.
Remote server: MySQL.
The linked server is communicating through MySQL ODBC 5.1
I created the following code for update (tried many other version too, this is the last one):
update openquery(Remoteserver,'select products_id, products_price, products_last_modified, products_stock from products1')
set
products_price=A.products_price,
products_stock=A.products_stock,
products_last_modified=getdate()
FROM
(select * from vi_products_update) AS A INNER JOIN
openquery(octopus, 'select products_id from products1')AS B
ON A.products_id=B.products_id
When I run the query the columns are updated with the same value, for each record. It looks the value is the first which match the criteria. Each (remote and local) table has as primary key products_id. In this example I used as result set for local a view, but I have the same result if I use a table.
the products_last_modified column is updated in order, and if I update for e.g. the products_price with a constant that is ok too. The problem should be somewhere with join, but I can' get it where.
THX for any help
abHi
Did you ever solve this problem
I have the same issue trying to update many rown in a MySQL table from SQL2005 using the syntax below,
UPDATE
openquery(DEV,'select id, `desc` from todLocationGroups')
SET [desc] = V.Destination_Group FROM
(select * from VTM_TOD_Rate) as V inner join
openquery(DEV,'select id, `desc` from todLocationGroups') as K
ON K.id = V.TOD_LG_ID
but i get this error
OLE DB provider "MSDASQL" for linked server "KAYOTE_DEV" returned message "Row cannot be located for updating. Some values may have been changed since it was last read.".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "KAYOTE_DEV" could not UPDATE table "[MSDASQL]". The rowset was using optimistic concurrency and the value of a column has been changed after the containing row was last fetched or resynchronized.
Maybe you are looking for
-
Installing iTunes 64 bit version on Windows 7
After downloading and starting the iTunes64setup.exe, the install program showed that it will install the program at C:\Programs Files(x86). This is the location for 32 bit programs. Why does the install program want to place this 64 bit program in t
-
Hi I have a task to complete on LabVIEW and i was wondering if anyone is willing to create it for me as it's the only piece missing for my personal project. I am not familiar with LabVIEW and therefore, if anyone is interested, i can pay you through
-
IPhoto organizing/help viewer
Organizing by date seems inoperable in Faces - how do you use it? Also, iPhoto Help says it's unable to open that content under the help viewer. I've repaired permissions as suggested in another post to no avail. Any other ideas?
-
¿me ayudan porqué me aparece este error en cs4?
premiere pro has encountered an error [..\..\Src\ComponentChain.cpp-496]
-
Brightness buttons no longer work on Apple Wireless Keyboard after Lion
They work fine on my MacBook Pro's keyboard, but the Apple Wireless Keyboard's keys were acting wonky yesterday. Today the brightness keys do not function at all. Tried rebooting. Restarting/switching batteries in keyboard. I sent a bug report to App