Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 TSQL import data

Author  Topic 

zain2
Starting Member

16 Posts

Posted - 2011-03-10 : 06:33:39
Error: Microsoft.Jet.OLEDB.4.0" has not been registered.

I am trying to import data from csv or xls file both giving me the save error. How can i find which OLEDB.4.0 registered on the server, so i could use the relevant OLEDB version?

select *
into Testing FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=c:\labdata\testing.csv;HDR=YES',
'SELECT * FROM [Sheet1$]')

Question Two:

I got a wierd csv file which i had to import into SQL

it comes with delimited and commas as follows:

testing.csv
Fname Lname DOB Tests Address Country
Scott,Treed,10/01/1950,"ABC,CDE,FFFF,GGGG,KKKK,",25 Avenue Texas,US
Scott,Treed,10/01/1950,"ABC,CDE,FFFF,GGGG,KKKK,,,",25 Avenue Texas,US
Scott,Treed,10/01/1950,"ABC,CDE,FFFF,GGGG,KKKK,",25 Avenue Texas,US
Scott,Treed,10/01/1950,"ABC,CDE,FFFF,GGGG,KKKK,,,",25 Avenue Texas,US
Scott,Treed,10/01/1950,"hhh,bbb,ccc,eeee,,",25 Avenue Texas,US
Scott,Treed,10/01/1950,"ABC,CDE,FFFF,GGGG,KKKK,,,",25 Avenue Texas,US
Scott,Treed,10/01/1950,"ABC,CDE,FFFF,GGGG,KKKK,,",25 Avenue Texas,US
XYZ,Johnson,10/01/1940,"ABC,CDE,FFFF,GGGG,KKKK,",15 Avenue Texas,US
XYZ,Johnson,10/01/1940,"ABC,CDE,FFFF,GGGG,KKKK,,",15 Avenue Texas,US
XYZ,Johnson,10/01/1940,"ABC,CDE,FFFF,GGGG,KKKK,",15 Avenue Texas,US
XYZ,Johnson,10/01/1940,"ABC,CDE,FFFF,GGGG,KKKK,,",15 Avenue Texas,US
XYZ,Johnson,10/01/1940,"ABC,CDE,FFFF,GGGG,KKKK,",15 Avenue Texas,US
XYZ,Johnson,10/01/1940,"ABC,CDE,FFFF,GGGG,KKKK,,",15 Avenue Texas,US

When i tried to import using Management Studio, the data getting imported but not in the relevant columns, specially because of column three which requires split into predifined columns Test1,Test2,Test3,Test4,Test5 and address into address column so on...

However, i created a sample data within SQL and manage to split column3 within SQL. it would have been lot easier if OLEDB works this could have resolved my problem.
select Fname,
dbo.fnSplitString(-1, ',', Replace(Tests,'"','')) As Test,
dbo.fnSplitString(-2, ',', Tests) as Test1,
dbo.fnSplitlString(-3, ',', Tests) as Test2
from #T


Unfortunatley, import issue is the biggest obstacle as i can't run bcp utility or Bulk insert on the server due to security restrictions put into place. The Data administrator is not willing to open this for me.

Help Help
My manager face is going yellow, greeeeeeen, red, pale and god knows what...

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-10 : 06:38:43
you may also use Microsoft.ACE.OLEDB.12.0

OPENROWSET('Microsoft.ACE.OLEDB.12.0', . . . .

you can get it from
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d&displaylang=en


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

zain2
Starting Member

16 Posts

Posted - 2011-03-10 : 06:45:51
Unfortunately, I don't have access to install on the server neither Administrator willingness.

How can i know what version of oledb is installed on the server using tsql command...before I press hard on the administrator to do so...

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-10 : 07:05:23
i don't know. It is easier just to ask the Server Admin


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -