Showing posts with label jet. Show all posts
Showing posts with label jet. Show all posts

Wednesday, March 21, 2012

import excel data fail in sql 2005

Hello,
When I use the sql server 2005 import and export wizard to import an excel
file, I always get "Could not find installable ISAM.(microsoft JET database
engine)" error.
my operating system is xp with sp2, sql server 2005, office 2003 and office
2007.
all of them have latest update (through microsoft update).
the excel file type is 97-2003 work sheet.
Within the System32 folder, there are MSJET40.dll (4.0.8618.0) and
MSEXCL40.dll (4.0.8618.0)
but I can not find the
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\engines\excel even after I
reinstall the xp sp2. there is
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\IIAM Formats\Excel 8.0
Currently, both sql 2005 and access 2003 can not import the data from excel
(97-2003 worksheet), but the access 2007 works well.
So I have to import the excel file into access 2007 first and then import it
into sql 2005.
Please tell me what can I do to fix this issue, your help are really
appreciated.Hi
I assume that you have seen
http://support.microsoft.com/kb/283881/
If you convert the file to excel 2007 can you import it? For a connection
string you would need Extended Properties=Excel 8.0 and I assume this is
expecting Excel 12.0 but I guess that is not going to help your current issue!
John
"med" wrote:
> Hello,
> When I use the sql server 2005 import and export wizard to import an excel
> file, I always get "Could not find installable ISAM.(microsoft JET database
> engine)" error.
> my operating system is xp with sp2, sql server 2005, office 2003 and office
> 2007.
> all of them have latest update (through microsoft update).
> the excel file type is 97-2003 work sheet.
> Within the System32 folder, there are MSJET40.dll (4.0.8618.0) and
> MSEXCL40.dll (4.0.8618.0)
> but I can not find the
> HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\engines\excel even after I
> reinstall the xp sp2. there is
> HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\IIAM Formats\Excel 8.0
> Currently, both sql 2005 and access 2003 can not import the data from excel
> (97-2003 worksheet), but the access 2007 works well.
> So I have to import the excel file into access 2007 first and then import it
> into sql 2005.
> Please tell me what can I do to fix this issue, your help are really
> appreciated.
>
>
>
>
>
>|||Thanks for your reply,
It does not work after I convert the excel file to 2007 such as 1.xlsx
The sql server 2005's import wizard can only support up to Excel 97-2005 so
that I get "File path contains invalid Excel file,Please provide file with
.xls extension" error.
I did read the article, but I can not even find the
MICROSOFT\Jet\4.0\engines\excel key in the registor.
My access 2007 does work well when import the excel file, but access 2003
and sql server 2005 does not work?
any thoughts?
"John Bell" wrote:
> Hi
> I assume that you have seen
> http://support.microsoft.com/kb/283881/
> If you convert the file to excel 2007 can you import it? For a connection
> string you would need Extended Properties=Excel 8.0 and I assume this is
> expecting Excel 12.0 but I guess that is not going to help your current issue!
> John
>
> "med" wrote:
> > Hello,
> >
> > When I use the sql server 2005 import and export wizard to import an excel
> > file, I always get "Could not find installable ISAM.(microsoft JET database
> > engine)" error.
> >
> > my operating system is xp with sp2, sql server 2005, office 2003 and office
> > 2007.
> > all of them have latest update (through microsoft update).
> >
> > the excel file type is 97-2003 work sheet.
> >
> > Within the System32 folder, there are MSJET40.dll (4.0.8618.0) and
> > MSEXCL40.dll (4.0.8618.0)
> > but I can not find the
> > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\engines\excel even after I
> > reinstall the xp sp2. there is
> > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\IIAM Formats\Excel 8.0
> >
> > Currently, both sql 2005 and access 2003 can not import the data from excel
> > (97-2003 worksheet), but the access 2007 works well.
> >
> > So I have to import the excel file into access 2007 first and then import it
> > into sql 2005.
> >
> > Please tell me what can I do to fix this issue, your help are really
> > appreciated.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >|||Hi
Have you tried creating an ODBC DSN and see if that works?
Searching for "Could not find installable ISAM" on microsoft.com
http://search.microsoft.com/results.aspx?q=Could+not+find+installable+ISAM&qsc0=0&FORM=QBME1&l=1&mkt=en-GB
turns up a large number of hits such as http://support.microsoft.com/kb/318161
John
"med" wrote:
> Thanks for your reply,
> It does not work after I convert the excel file to 2007 such as 1.xlsx
> The sql server 2005's import wizard can only support up to Excel 97-2005 so
> that I get "File path contains invalid Excel file,Please provide file with
> .xls extension" error.
> I did read the article, but I can not even find the
> MICROSOFT\Jet\4.0\engines\excel key in the registor.
> My access 2007 does work well when import the excel file, but access 2003
> and sql server 2005 does not work?
> any thoughts?
> "John Bell" wrote:
> > Hi
> >
> > I assume that you have seen
> > http://support.microsoft.com/kb/283881/
> >
> > If you convert the file to excel 2007 can you import it? For a connection
> > string you would need Extended Properties=Excel 8.0 and I assume this is
> > expecting Excel 12.0 but I guess that is not going to help your current issue!
> >
> > John
> >
> >
> > "med" wrote:
> >
> > > Hello,
> > >
> > > When I use the sql server 2005 import and export wizard to import an excel
> > > file, I always get "Could not find installable ISAM.(microsoft JET database
> > > engine)" error.
> > >
> > > my operating system is xp with sp2, sql server 2005, office 2003 and office
> > > 2007.
> > > all of them have latest update (through microsoft update).
> > >
> > > the excel file type is 97-2003 work sheet.
> > >
> > > Within the System32 folder, there are MSJET40.dll (4.0.8618.0) and
> > > MSEXCL40.dll (4.0.8618.0)
> > > but I can not find the
> > > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\engines\excel even after I
> > > reinstall the xp sp2. there is
> > > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\IIAM Formats\Excel 8.0
> > >
> > > Currently, both sql 2005 and access 2003 can not import the data from excel
> > > (97-2003 worksheet), but the access 2007 works well.
> > >
> > > So I have to import the excel file into access 2007 first and then import it
> > > into sql 2005.
> > >
> > > Please tell me what can I do to fix this issue, your help are really
> > > appreciated.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >|||Thanks John,
I had done a lot this kind of search, but can not find anything helpful.
Can you reproduce my error, just install the office2003, office2007,and sql
server 2005 on XP with sp2 to see if you can get this error?
I can create link servers to access databases by using either "Jet 4.0" or
"office 12.0 access database engine ole db provider", but no one work for
Excel.
Please test it and no more assumptions.
"John Bell" wrote:
> Hi
> Have you tried creating an ODBC DSN and see if that works?
> Searching for "Could not find installable ISAM" on microsoft.com
> http://search.microsoft.com/results.aspx?q=Could+not+find+installable+ISAM&qsc0=0&FORM=QBME1&l=1&mkt=en-GB
> turns up a large number of hits such as http://support.microsoft.com/kb/318161
> John
> "med" wrote:
> > Thanks for your reply,
> > It does not work after I convert the excel file to 2007 such as 1.xlsx
> >
> > The sql server 2005's import wizard can only support up to Excel 97-2005 so
> > that I get "File path contains invalid Excel file,Please provide file with
> > .xls extension" error.
> >
> > I did read the article, but I can not even find the
> > MICROSOFT\Jet\4.0\engines\excel key in the registor.
> >
> > My access 2007 does work well when import the excel file, but access 2003
> > and sql server 2005 does not work?
> >
> > any thoughts?
> >
> > "John Bell" wrote:
> >
> > > Hi
> > >
> > > I assume that you have seen
> > > http://support.microsoft.com/kb/283881/
> > >
> > > If you convert the file to excel 2007 can you import it? For a connection
> > > string you would need Extended Properties=Excel 8.0 and I assume this is
> > > expecting Excel 12.0 but I guess that is not going to help your current issue!
> > >
> > > John
> > >
> > >
> > > "med" wrote:
> > >
> > > > Hello,
> > > >
> > > > When I use the sql server 2005 import and export wizard to import an excel
> > > > file, I always get "Could not find installable ISAM.(microsoft JET database
> > > > engine)" error.
> > > >
> > > > my operating system is xp with sp2, sql server 2005, office 2003 and office
> > > > 2007.
> > > > all of them have latest update (through microsoft update).
> > > >
> > > > the excel file type is 97-2003 work sheet.
> > > >
> > > > Within the System32 folder, there are MSJET40.dll (4.0.8618.0) and
> > > > MSEXCL40.dll (4.0.8618.0)
> > > > but I can not find the
> > > > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\engines\excel even after I
> > > > reinstall the xp sp2. there is
> > > > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\IIAM Formats\Excel 8.0
> > > >
> > > > Currently, both sql 2005 and access 2003 can not import the data from excel
> > > > (97-2003 worksheet), but the access 2007 works well.
> > > >
> > > > So I have to import the excel file into access 2007 first and then import it
> > > > into sql 2005.
> > > >
> > > > Please tell me what can I do to fix this issue, your help are really
> > > > appreciated.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >|||Hi
Unfortunately I don't have the facilities to do that. In general a
production environment would not have office installed. If you are not able
to create your own test environment then you may want to raise a PSS incident.
John
"med" wrote:
> Thanks John,
> I had done a lot this kind of search, but can not find anything helpful.
> Can you reproduce my error, just install the office2003, office2007,and sql
> server 2005 on XP with sp2 to see if you can get this error?
> I can create link servers to access databases by using either "Jet 4.0" or
> "office 12.0 access database engine ole db provider", but no one work for
> Excel.
> Please test it and no more assumptions.
>
> "John Bell" wrote:
> > Hi
> >
> > Have you tried creating an ODBC DSN and see if that works?
> >
> > Searching for "Could not find installable ISAM" on microsoft.com
> > http://search.microsoft.com/results.aspx?q=Could+not+find+installable+ISAM&qsc0=0&FORM=QBME1&l=1&mkt=en-GB
> >
> > turns up a large number of hits such as http://support.microsoft.com/kb/318161
> >
> > John
> >
> > "med" wrote:
> >
> > > Thanks for your reply,
> > > It does not work after I convert the excel file to 2007 such as 1.xlsx
> > >
> > > The sql server 2005's import wizard can only support up to Excel 97-2005 so
> > > that I get "File path contains invalid Excel file,Please provide file with
> > > .xls extension" error.
> > >
> > > I did read the article, but I can not even find the
> > > MICROSOFT\Jet\4.0\engines\excel key in the registor.
> > >
> > > My access 2007 does work well when import the excel file, but access 2003
> > > and sql server 2005 does not work?
> > >
> > > any thoughts?
> > >
> > > "John Bell" wrote:
> > >
> > > > Hi
> > > >
> > > > I assume that you have seen
> > > > http://support.microsoft.com/kb/283881/
> > > >
> > > > If you convert the file to excel 2007 can you import it? For a connection
> > > > string you would need Extended Properties=Excel 8.0 and I assume this is
> > > > expecting Excel 12.0 but I guess that is not going to help your current issue!
> > > >
> > > > John
> > > >
> > > >
> > > > "med" wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > When I use the sql server 2005 import and export wizard to import an excel
> > > > > file, I always get "Could not find installable ISAM.(microsoft JET database
> > > > > engine)" error.
> > > > >
> > > > > my operating system is xp with sp2, sql server 2005, office 2003 and office
> > > > > 2007.
> > > > > all of them have latest update (through microsoft update).
> > > > >
> > > > > the excel file type is 97-2003 work sheet.
> > > > >
> > > > > Within the System32 folder, there are MSJET40.dll (4.0.8618.0) and
> > > > > MSEXCL40.dll (4.0.8618.0)
> > > > > but I can not find the
> > > > > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\engines\excel even after I
> > > > > reinstall the xp sp2. there is
> > > > > HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\4.0\IIAM Formats\Excel 8.0
> > > > >
> > > > > Currently, both sql 2005 and access 2003 can not import the data from excel
> > > > > (97-2003 worksheet), but the access 2007 works well.
> > > > >
> > > > > So I have to import the excel file into access 2007 first and then import it
> > > > > into sql 2005.
> > > > >
> > > > > Please tell me what can I do to fix this issue, your help are really
> > > > > appreciated.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >

Friday, March 9, 2012

Import csv files to Sql Server problem

Hi,

I try to import csv files to Sql Server using .net. The code is as following:

string strCsvConn =@."Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\;Extended Properties='text;HDR=Yes;FMT=Delimited(,)';";

using (OleDbConnection cn =newOleDbConnection(strCsvConn))

{

string strSQL ="SELECT * FROM " + strFileName;

OleDbCommand cmd =newOleDbCommand(strSQL, cn);

cn.Open();

using (OleDbDataReader dr = cmd.ExecuteReader())

{

// Bulk Copy to SQL Server

using (SqlBulkCopy bulkCopy =newSqlBulkCopy(strSqlConn))

{

bulkCopy.DestinationTableName = strSqlTable;

bulkCopy.WriteToServer(dr);

}

}

}

And the data is as following (simplified):

Model,Serial

AFICIO 3045,K9464900965

AFICIO 3045,K9464900932

Fax 5510L,A3761290041

Fax 2210L,A4978800008

AFICIO 3025,K8565201014

AFICIO 3025,K8565102398

The result of the 2nd column is: 9464900965, 9464900932, null, null, 8565201014, 8565102398 - either the first character is missing or the whole entry is missing.

One more weird thing is that some other files work fine, though I am not able to tell any difference between them.

Any idea is hoghly appreciated.

shz

Hmmm... what's the datatype / size of the second column in your destination database?

In your example, the two rows that get null in second column contains a space in the first column. Is it maybe because space is used as a separator too in some way?|||

Thanks johram,

The datatype is varchar(50). However, I am afraid it has nothing to with the database, because it is the DataReader that retrieves wrong data. I test the DataReader with the following code:

while (dr.Read())

{

string str =Convert.ToString(dr[1]);

}

And all entries in the 1st column contain a space. The file contains more than 10 columns actually, all other columns are good.

Some more findings:

I have some "good" files that work fine and some "bad" files that have this problem - I cannot tell any difference between them in terms of data format. If I copy some records from a "good" file to a "bad" file, those records become bad. If I copy some records from a "bad" file to a "good" file, those records become good.

If I use TDS to import the files to SQL Server, it works fine. Excel can open the files properly too.

Thanks,

shz

|||

It seems to be the problem in the header (columns) of the cvs file.

Please make sure thay are okay.

Good luck.

|||

Fixed - need a Schema.ini file to define the Extended Properties of the driver.

Thanks to everyone.

Friday, February 24, 2012

import a text file into the database

hello,
i want to import a textfile in the database (SQL)
For access.database the code like:
cnn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\DB1.mdb;" & _
"Jet OLEDB:Engine Type=4;"
sqlString = "SELECT * INTO [tblSample2] FROM
[Text;HDR=NO;DATABASE=e:\My Documents\TextFiles].[Sample2.txt]"
cnn.Execute sqlString
works ok
How can i use such a command for the sql server
sqlString = "SELECT * INTO [tblSample2] FROM
[Text;HDR=NO;DATABASE=e:\My Documents\TextFiles].[Sample2.txt]"
i get the error
"Invalid object name 'Text;HDR=NO;DATABASE=e:\My
Documents\TextFiles\Sample2.txt'."
best regardsYou can use a passthrough query like:
INSERT tbl
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="e:\My Documents\TextFiles].[Sample2.txt]";
User ID=Admin;Password=;Extended properties=text )
Another option is to use xp_cmdshell directly like:
INSERT tbl
EXEC master..xp_cmdshell 'TYPE e:\My Documents\TextFiles].[Sample2.txt]" ;
For complex ascii files you should consider using BULK INSERT/BCP IN or
DTS( Data transformation Services ). See SQL Server Books Online for details
on these utilities.
Anith|||hello Anith,
i tryed to run in the query analyser the command
SELECT * FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data
Source="e:\transfer\Input\t1.txt";Extended properties=text')
but i get the syntax error
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ')'.
any idea?
thanks
Xavier
"Anith Sen" wrote:

> You can use a passthrough query like:
> INSERT tbl
> SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="e:\My Documents\TextFiles].[Sample2.txt]";
> User ID=Admin;Password=;Extended properties=text )
> Another option is to use xp_cmdshell directly like:
> INSERT tbl
> EXEC master..xp_cmdshell 'TYPE e:\My Documents\TextFiles].[Sample2.txt]" ;
> For complex ascii files you should consider using BULK INSERT/BCP IN or
> DTS( Data transformation Services ). See SQL Server Books Online for detai
ls
> on these utilities.
> --
> Anith
>
>