I connected my MS SQL Server database to Firebird using odbc. When I use a SELECT statement it works perfectly. The error occurs when I try to UPDATE. I get this error message:
The OLE DB provider "MSDASQL" for linked server "server_name" could not update table
The strange thing is, it can update some other tables in the same db, but not a select few.
Related
I tried to export data from SQL Server 2014 to Excel.
I tried like this
insert into OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0
Xml;HDR=YES;Database=D:\testing.xlsx;',
'SELECT OI_NAME,OI_ADDRESSS FROM [Sheet1$]') select OI_NAME,
OI_ADDRESSS from OI_TEMP
But I get this error
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
I searched on the internet, and found this:
The SQL Server Error Message if a user have no rights for SQL Server TEMP directory OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Unspecified 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)".
But I assign permission is still does not work.
Why?
To export data from SQL to Excel, you need to follow 2 steps:
Step 1: Connect Excel to your SQL database (Microsoft SQL Server, MySQL, PostgreSQL...)
Step 2: Import your SQL data into Excel
The result will be the list of tables you want to query data from your SQL database into Excel:
Step1: Connect Excel to an external data source: your SQL database
Install An ODBC
Install A Driver
Avoid A Common Error
Create a DSN
Step 2: Import your SQL data into Excel
Click Where You Want Your Pivot Table
Click Insert
Click Pivot Table
Click Use an external data source, then Choose Connection
Click on the System DSN tab
Select the DSN created in ODBC Manager
Fill the requested username and password
Avoid a Common Error
Access The Microsoft Query Dialog Box
Click on the arrow to see the list of tables in your database
Select the table you want to query data from your SQL database into Excel
Click on Return Data when you’re done with your selection
To update the export automatically, there are 2 additional steps:
Create a Pivot Table with an external SQL data source
Automate Your SQL Data Update In Excel With The GETPIVOTDATA Function
I've created a step-by-step tutorial about this whole process, from connecting Excel to SQL, up to having the whole thing automatically updated. You might find the detailed explanations and screenshots useful.
I try on a few years ago, do it that way and it was not possible, I suggest you use this form to export data to Excel from SQL -server.
Font: Microsoft Developer Network
Create an excel file, then option Data -> From other source -> From SQL Server
Select input your server, user and password, then select database and choose your table.
See this video:
Video Tutorial - SQL server to Excel
Then, you can code a macro on VBA to update automatically excel file
sub Auto_Open ()
ActiveWorkbook.RefreshAll
end sub
I hope this help to you!
I am trying to select some data from Excel into my SQL query.
I have the following query:
SELECT*
FROM
openrowset('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=S:\Nh\NHData.xlsx;',
'SELECT *
FROM [Pre Upgrade data$]') as t2
If I run this on my local SQL server instance, it works fine, however to get it to work, I had to follow the procedure outlined on the below link, setting the SQL server service to run as my user account.
http://www.aspsnippets.com/Articles/The-OLE-DB-provider-Microsoft.Ace.OLEDB.12.0-for-linked-server-null.aspx
Without changing the user, I would get the following error:
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
For obvious reasons I cannot change the SQL server user on my live SQL database server.
How can I get this to run?
Hi All I am trying to create a View from another database server...
I have have got server A an din Server A is where i want to create a view referencing a table from Server B.... when I run the command below:
create view TableFromServerB as select * from ServerB.master.information_schema.table;
I get the following error:
OLE DB provider "SQLNCLI11" for linked server "ServerB" returned
message "Login timeout expired". OLE DB provider "SQLNCLI11" for
linked server "ServerB" returned message "A network-related or
instance-specific error has occurred while establishing a connection
to SQL Server. Server is not found or not accessible. Check if
instance name is correct and if SQL Server is configured to allow
remote connections. For more information see SQL Server Books
Online.". Msg 53, Level 16, State 1, Line 0 Named Pipes Provider:
Could not open a connection to SQL Server [53].
I have done some research online and i came to a source that suggested using sp_addlinkedserver in my command .. which i have done and when i did this it said server already exists . So is there anything i am missing out here??
I have seen an issue like this before:
Can you please do something like this:
Create a view in your linked server to access the object i.e master.information_schema.table;
Use this view in the queries from the server where you want to display the results.
Eg:
--- create view script--
create view dbo.vINFORMATION_SCHEMATABLES
as
SELECT *
FROM INFORMATION_SCHEMA.TABLES
go
-- select statement from local server
select * from [testSRV].[testDB_far].[dbo].[vINFORMATION_SCHEMATABLES]
Let me know if this helps.
I am developping some code that transfers data between SQL servers. In this phase, all my work is on the same server (local, where I am the owner), but I am already trying to implement the OPENROWSET functionnalities that will be used at production time (where data will be on different servers and where I will have to build queries for the transfers). The following 3 codes are supposed to do the very same thing, but the one making use of OPENROWSET is giving me an error ... Bref, I am stuck! if anyone could help...
3 parts naming: works
USE db1
SELECT * INTO dbo.myTable FROM db2.dbo.myTable
OPENDATASOURCE: works
USE db1
SELECT * INTO dbo.myTable FROM OPENDATASOURCE
('SQLOLEDB',
'Data Source=127.0.0.1\SQLEXPRESS;Integrated Security=SSPI'
).db2.dbo.myTable
OPENROWSET: does not work
USE db1
SELECT * INTO dbo.myTable FROM OPENROWSET
('SQLOLEDB',
'Trusted_Connection=yes;Server=(Local)',
'db2.dbo.myTable')
Where I am getting the following message:
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "Login timeout expired".
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
Of course I have tried to use the standard properties of my connection string (as with OPENDATASOURCE) but I was also getting the following error:
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "Invalid authorization specification".
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "Invalid connection string attribute".
For one thing: Your OPENROWSET statement isn't specifying the server instance.
Try
USE db1
SELECT * INTO dbo.myTable FROM OPENROWSET
('SQLOLEDB',
'Trusted_Connection=yes;Server=127.0.0.1\SQLEXPRESS',
'db2.dbo.myTable')
One aspect of our system requires our SQL Server instance to talk to a MySQL Server via a linked Server Connection.
MSSQL -> LinkedServer(MSDASQL ODBC Provider) -> MySQL ODBC Connector -> MySQL DB
The Table on the linked server is called in a SPROC along the lines of
CREATE PROCEDURE DoStuff
AS
SELECT a.ID, a.Name, b.OtherProperty
FROM MyDatabase..MyTable a
JOIN LINKSRVR...OtherTable b
ON a.ID = b.ID
GO
The problem is that the MySQL database lives on another network, only accessible by VPN & that the CREATE or ALTER statement breaks with the following error unless the VPN is active.
The OLE DB provider "MSDASQL" for linked server "LINKSRVR" reported an error.
The provider did not give any information about the error.
Cannot initialize the data source object of OLE DB provider
"MSDASQL" for linked server "LINKSRVR".
Is there anyway to force SQL Server to just go ahead and create the SPROC with the SQL I tell it and not to try and validate if the LinkedServer is up/down.
You'd have to "hide" the offending SQL from the compiler by placing it in a string and executing it as dynamic SQL.