SQL Server Import OLE DB error 0x80040E09 - sql-server

I just installed SQL Server 2014 and now I'm trying to import an Access database. To do the import I use the SQL Server 2014 Import and Export Data Wizard. I can go trough all steps of the wizard except the step below, which gives me this error.
The red underlined text is Dutch the translation for this line is: Cannot read the records. U don't have permission for tblAanmaningHistorie to read the data.
tblAanmaningHistorie is the first table in the Access database, when I try to import other tables I get the same error.
Data source screen
How to fix this?

Related

Cannot Import DB using the Azure Portal

I am trying to import a DB in the Azure Portal. The original DB I exported from was on a different server, but is setup identically to where I am trying to import. I am importing by going to the target server and clicking the import button. I then choose the storage account, container, and bacpac file I would like to import. I check that the database size and type are the same for the import as the bacpac file. I also double check that the collation is the same on the import as it is in the bacpac. I then confirm. It attempts to do the import for about 20 minutes before giving the error message below. I can see the DB is created when I go to the sql server and click the sql databases blade, but the tables inside the DB are empty.
Could not import package.
Warning SQL72012: The object [data_0] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Warning SQL72012: The object [log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Error SQL72014: .Net SqlClie
I have seen some responses in regards to similar issues, but they all seem to be using SSMS. Does anyone have any ideas on how to fix this issue inside the Azure Portal? Also, does anyone know what check box they are talking about? there is no checkbox when I am doing the import setup.
The warnings you are getting are a bit of a red herring. The issue is with the error you are getting. The line you posted only shows a generic error which should be followed by the actual error after. Try going to the actual database server and check import\export history.
try also importing using powershell which may give you some more details on the error you are getting:
$importStatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $importRequest.OperationStatusLink
[Console]::Write("Importing")
while ($importStatus.Status -eq "InProgress") {
$importStatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $importRequest.OperationStatusLink
[Console]::Write(".")
Start-Sleep -s 10
}
[Console]::WriteLine("")
$importStatus
Without knowing what the error you are getting it's a bit of a stab in the dark trying to guess what the issue is. Giving the version of SQL you are exporting from I can guess this is an on prem database server.
One of the common reasons dacpac files tend to fail when importing is your source database server isn't configured to allow contained databases
If that's the case, you need to go to your source database server (where you are exporting from) and enable that option:
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
Once this is run, recreate your dacpac file and try to import that.
As I mentioned, this is a complete stab in the dark as you haven't provided the error you are actually getting

SELECT * INTO another database on a different SQL instance running older SQL Server

I need to copy some tables from a SQL Server 2016 instance to a SQL Server 2008 instance like
select *
into [sql8].[DatabaseA].[dbo].[Customers]
from [DatabaseA].[dbo].[Customers]
but I get an error:
Msg 117, Level 15, State 1, Line 9
The object name 'sql8.DatabaseA.dbo.Customers' contains more than the maximum number of prefixes. The maximum is 2.
I have tried generating a script of the data but my machine runs out of memory during SQLCMD execution from the command line.
Looking for recommendations / pointer.
Thanks
I'm guessing you may need to set up the sql8 server as a linked server from the Server holding the DB you're trying to get the data into. In the image I would be trying to get the data into a db on the MJAYWCO1 server. [sql8] would be the server you want to create a link "to". "[sql8].[DatabaseA].[dbo].[Customers]"
To Do this from the ssms GUI goto Server.ServerObjects.LinkedServers:
Another possibility: Have you tried to import it directly to the new DB? Assuming you can connect to the old database from the new database with creds...
If this doesn't work, you can use the Export Data from the DB you are trying to get the data (under Import data in the second Image) from the "old DB" to create an XML or .CSV file, or whatever might be an applicable format. Use this and the Import Wizard from the "new DB"
Please forgive me if I misunderstood the question as English is my first language and I went to government schools.

ogr2ogr to import GML with spatial and non-in SQL Server

I am trying to use ogr2ogr to import GML file into SQL Server Spatial. I successfully import features with geometry, but I have few without geometry column. How can I import all of them?
EDIT:
I reinstalled GDAL, installed latest, works fine, but again cann't write non-spatial features.
Constantly getting error:
ERROR 1: Error creating layer: [Microsoft][ODBC SQL Server Driver][SQL
Server]Incorrect syntax near 'NULLCONSTRAINT'.
The error looks like incorrectly formed SQL statement, created by ogr2ogr against the SQL database.
Have you tried running SQL Server Profiler (within SQL Server) whilst you do the import? Assuming you run a standard trace, you will need to locate the row with NULLCONSTRAINT in the textData column in the trace output. Once you have found the problem statement, this should give you some idea how to fix the problem.
If you need a very simple tutorial on the Profiler this link might help
http://www.mssqltips.com/sqlservertutorial/272/profiler-and-server-side-traces/
A similar error for me was caused by square brackets in the shapefile name I was importing which meant the create table statement was invalid.

Trying to Import FoxPro DBF File to SQL Server

As the title says, I'm trying to import a FoxPro dbf file into sql server using openrowset. At first I tried to export the DBF to an xls file and import using the Import/Export wizard. This works pretty well normally, but there is one field that sometimes holds a really long string, and this string is being truncated at 4096 characters during the export from the dbf to xls.
I found an old post with instructions on how to do this using openrowset.
When I try the first answer:
select *
from openrowset('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;
SourceDB=\\path\;
SourceType=DBF',
'select * from TABLE.DBF')
I get the error:
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)".
When I try the second answer:
select *
from openrowset('VFPOLEDB',
'\\Path\';'';'',
'select * from TABLE.DBF')
I get the error:
Msg 7403, Level 16, State 1, Line 1
The OLE DB provider "VFPOLEDB" has not been registered.
I tried to register the OLE*.dll files manually with regsvr32, but only some of them worked. On ole32, oleacc, oleaut32, and oleprn I got a success message. On oleacchooks, oleaccrc, oledlg, and oleres I got this error:
The module "oleacchooks" was loaded but the
entry-point DllRegisterServer was not found.
Make sure that "oleacchooks" is a valid DLL or OCX file
and then try again
After some investigation I tried to install the componet, but when I tried to install the msi file for FoxPro (found here), I got this error:
An error occurred while processing the last operation.
Error code 80110408 - Error occurred reading the application file
The event log may contain additional troubleshooting information.
So, I'm officially lost here. Does anybody have suggestions on how to get openrowset to work, or some other way of importing the dbf file?
Pat, you can use DBF Commander Pro for this task.
Download it, install, then click File -> Export to DBMS. In the window appears click Build button in order to build the connection string: select MS OLEDB Provider for SQL Server, then choose your server from the list, provide login and password, select a database, click OK:
In the Export to DBMS window select the destination table you want to import source DBF file to, then click Export.
More info on import and export DBF to a database you can find here.
P.S. The app has fully functional free trial 20-days period.
Try using VFPOLEDB.1 as the provider. You may be experiencing driver version issues.

How do I copy all tables in database to Excel

I have a SQL Server 2008 database and I wanted to quickly copy all the data in the database into either separate Excel spreadsheets or into a single spreadsheet in separate tabs. Putting the data into separate CSV files is also ok. How do I do this without having to do a select * from for each of the tables and then copying the data into Excel? There are a lot of tables.
EDIT
Running the wizard to export data I get this error on Pre-execute
Pre-execute (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
(SQL Server Import and Export Wizard)
Error 0xc0202025: Data Flow Task 1: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
(SQL Server Import and Export Wizard)
Error 0xc004701a: Data Flow Task 1: component "Destination - ApprovalStatuses" (25) failed the pre-execute phase and returned error code 0xC0202025.
(SQL Server Import and Export Wizard)
Thanks,
Sachin
Using Server Management Studio:
Server Management Studio (right click on db) >
Tasks >
Export >
Login >
Destination box select Microsoft Excel > ...
If you are on a 64-bit server then;
Windows > Start Button >
All Programs >
MS Sql Server [your version] >
USE Import and Export Data (32-bit)
See this link http://www.66pacific.com/sql_server_export_to_excel.aspx
Using the SQL Server Import and Export Wizard, you can easily copy tables from the database to the spreadsheet.
You can directrly export table from database to excel file using sql-server Import and Export Wizard.
Have look at this article about Exporting SQL Server Data to Excel.
Ok, see this link http://www.hotscripts.com/forums/windows-net-programming/59962-export-data-database-excel-via-sql-command-customize-style-vb-net-without-auto.html for a quick way of doing it.
Ideally, if you get time to program it, I would use RDLC to build custom reports which you can export out as Excel using DataTables.
See my blog post at https://mashupweb.wordpress.com/2012/02/08/creating-an-online-list-of-users-in-a-database-using-report-wizard/ on how export data onto Excel using RDLC.

Resources