Showing posts with label opendatasource. Show all posts
Showing posts with label opendatasource. Show all posts

Friday, March 23, 2012

OPENDATASOURCE: text file as input ?

Version 2000.
How do I do something like the example

SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended
properties=Excel 5.0')...xactions

but use a .txt-file instead ?

I tried building it using Access (that usually works :-) ) and that gives a
connectionstring of:
Text;DSN=Link
Sammenkdningsspecifikation;FMT=Delimited;HDR=NO;I MEX=2;CharacterSet=850;DAT
ABASE=c:\temp
Sourcetablename=link.txt

but I can't seem to "massage" it into working on the sql-server.

If I quick and dirty swap 'Microsoft.Jet.OLEDB.4.0' with 'Text' it gives
error:
Could not locate registry entry for OLE DB provider 'Text'.

tia
/jim"Jim Andersen" <jimVK@.officeconsult.dk> wrote in message
news:40bf26a4$0$3050$14726298@.news.sunsite.dk...
> Version 2000.
> How do I do something like the example
> SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended
> properties=Excel 5.0')...xactions
> but use a .txt-file instead ?
> I tried building it using Access (that usually works :-) ) and that gives
a
> connectionstring of:
> Text;DSN=Link
Sammenkdningsspecifikation;FMT=Delimited;HDR=NO;I MEX=2;CharacterSet=850;DAT
> ABASE=c:\temp
> Sourcetablename=link.txt
> but I can't seem to "massage" it into working on the sql-server.
> If I quick and dirty swap 'Microsoft.Jet.OLEDB.4.0' with 'Text' it gives
> error:
> Could not locate registry entry for OLE DB provider 'Text'.
> tia
> /jim

These articles might be helpful - you need a schema.ini file in addition to
the DSN:

http://www.users.drew.edu/skass/sql/TextDriver.htm
http://support.microsoft.com/defaul...kb;EN-US;149090

Simon|||Simon Hayes wrote:
> "Jim Andersen" <jimVK@.officeconsult.dk> wrote in message
> news:40bf26a4$0$3050$14726298@.news.sunsite.dk...
>> Version 2000.
>> How do I do something like the example
>>
>> SELECT *
>> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
>> 'Data Source="c:\Finance\account.xls";User
>> ID=Admin;Password=;Extended properties=Excel 5.0')...xactions
>>
>> but use a .txt-file instead ?

> These articles might be helpful - you need a schema.ini file in
> addition to the DSN:
> http://www.users.drew.edu/skass/sql/TextDriver.htm
> http://support.microsoft.com/defaul...kb;EN-US;149090

Thx Simon, the links were very helpful.

Here is the solution:

File c:\temp\link.txt
10248;"Vins et alcools Chevalier";7/4/1996 0:00:00
10249;"Toms Spezialitten";7/5/1996 0:00:00
10250;"Hanari Carnes";7/8/1996 0:00:00

File c:\temp\schema.ini
[link.txt]
Format=Delimited(;)
CharacterSet=OEM
ColNameHeader=False
Col1=CustomerNumber Long
Col2=CustomerName Text Width 40
Col3=EntryDate Datetime

SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\temp";Extended properties=Text')...table1#txt

And a link about schema.ini
http://msdn.microsoft.com/library/d...ma_ini_file.asp

But... I can't get it to work with
Format=Delimited(,)
or
Format=CSVDelimited
and
File c:\temp\link.txt
10248,"Vins et alcools Chevalier",7/4/1996 0:00:00
10249,"Toms Spezialitten",7/5/1996 0:00:00
10250,"Hanari Carnes",7/8/1996 0:00:00

or a ";" instead of a ","

But never mind....
/jima|||<snip
> Thx Simon, the links were very helpful.
> Here is the solution:
> File c:\temp\link.txt
> 10248;"Vins et alcools Chevalier";7/4/1996 0:00:00
> 10249;"Toms Spezialitten";7/5/1996 0:00:00
> 10250;"Hanari Carnes";7/8/1996 0:00:00
> File c:\temp\schema.ini
> [link.txt]
> Format=Delimited(;)
> CharacterSet=OEM
> ColNameHeader=False
> Col1=CustomerNumber Long
> Col2=CustomerName Text Width 40
> Col3=EntryDate Datetime
> SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="c:\temp";Extended properties=Text')...table1#txt
> And a link about schema.ini
http://msdn.microsoft.com/library/d...ma_ini_file.asp
> But... I can't get it to work with
> Format=Delimited(,)
> or
> Format=CSVDelimited
> and
> File c:\temp\link.txt
> 10248,"Vins et alcools Chevalier",7/4/1996 0:00:00
> 10249,"Toms Spezialitten",7/5/1996 0:00:00
> 10250,"Hanari Carnes",7/8/1996 0:00:00
> or a ";" instead of a ","
> But never mind....
> /jima

Format=CSVDelimited seems to work fine for me, using your sample above:

[test.txt]
Format=CSVDelimited
CharacterSet=OEM
ColNameHeader=False
Col1=CustomerNumber Long
Col2=CustomerName Text Width 40
Col3=EntryDate Datetime

SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=c:\scripts;Extended properties=Text')...test#txt

What error message do you get?

Simon|||>> But... I can't get it to work with
>> Format=Delimited(,)
>> or
>> Format=CSVDelimited
>> and
>> File c:\temp\link.txt
>> 10248,"Vins et alcools Chevalier",7/4/1996 0:00:00
>> 10249,"Toms Spezialitten",7/5/1996 0:00:00
>> 10250,"Hanari Carnes",7/8/1996 0:00:00
>>
>> or a ";" instead of a ","

> Format=CSVDelimited seems to work fine for me, using your sample
> above:
> [test.txt]
> Format=CSVDelimited
> CharacterSet=OEM
> ColNameHeader=False
> Col1=CustomerNumber Long
> Col2=CustomerName Text Width 40
> Col3=EntryDate Datetime
> SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source=c:\scripts;Extended properties=Text')...test#txt
> What error message do you get?

Hmmm, today it behaves a little different :-) I was sure it gave me a "ole
db error. the provider didnt return any information about what went wrong."
but today it gives me

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
[OLE/DB provider returned message: Tekstfilspecifikationens feltseparator er
magen til decimalseparatoren eller tekstafgrnseren.]
Which means "The textfile's fieldseparator is the same as the
decimalseparator or the textdelimiter."

But now I can get it to work with ";" and Format=Delimited(;)

thx again,

/jim

OpenDataSource()

Hello, I am trying to connect to a JBase database via an Attunity Connect
ODBC machine DSN but I'm struggling with the syntax. The DSN is called
ClarityODBC and this is the syntax I'm using:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=ClarityOD
BC;').CLARITY.[PUBLIC].
1;TRANS]
I get 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".
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI" for linked server "(null)" reported an error.
Authentication failed.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "SQLNCLI" for
linked server "(null)".
Obviously, I am doing something wrong but I haven't used OpenDataSource
before and I am struggling to find samples for the above scenario ie using a
System DSN and I'm not even sure if I should be using SQLOLEDB
Any help is greatly appreciated.
Many thanks
MarkHi, Mark,
From your description, I understand that:
You encountered the error :
OLE DB provider "SQLNCLI" for linked server "(null)" returned message
"Invalid authorization specification".
When you executed the distributed query:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=ClarityOD
BC;').CLARITY.[PUBLIC].
1;TRANS]
If I have misunderstood, please let me know.
The error should be caused by not specifying authentication information.
If you would like to use Windows authentication, please add "Integrated
Security=SSPI" to the init_string parameter, for example:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=MySQL2000
;Integrated
Security=SSPI').Northwind.dbo.Categories
If you use SQL Authentication, please add "User
ID=<userid>;Password=<password>" to the init_string parameter. It is
recommended that your password uses a strong name. For example:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=MySQL2000
;User
Id=sa;Password=Password!01').Northwind.dbo.Categories
Hope this helps. If you have any other questions or concerns, please feel
free to let me know.
Have a good day!
Charles Wang
Microsoft Online Community Support
========================================
=============
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||Hi,
I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
Have a good day!
Charles Wang
Microsoft Online Community Support
========================================
==============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============

OpenDataSource()

Hello, I am trying to connect to a JBase database via an Attunity Connect
ODBC machine DSN but I'm struggling with the syntax. The DSN is called
ClarityODBC and this is the syntax I'm using:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=ClarityODBC;').CLAR ITY.[PUBLIC].[TRANS]
I get 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".
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI" for linked server "(null)" reported an error.
Authentication failed.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "SQLNCLI" for
linked server "(null)".
Obviously, I am doing something wrong but I haven't used OpenDataSource
before and I am struggling to find samples for the above scenario ie using a
System DSN and I'm not even sure if I should be using SQLOLEDB
Any help is greatly appreciated.
Many thanks
Mark
Hi, Mark,
From your description, I understand that:
You encountered the error :
OLE DB provider "SQLNCLI" for linked server "(null)" returned message
"Invalid authorization specification".
When you executed the distributed query:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=ClarityODBC;').CLAR ITY.[PUBLIC].[TRANS]
If I have misunderstood, please let me know.
The error should be caused by not specifying authentication information.
If you would like to use Windows authentication, please add "Integrated
Security=SSPI" to the init_string parameter, for example:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=MySQL2000;Integrate d
Security=SSPI').Northwind.dbo.Categories
If you use SQL Authentication, please add "User
ID=<userid>;Password=<password>" to the init_string parameter. It is
recommended that your password uses a strong name. For example:
SELECT *
FROM OPENdatasource('SQLOLEDB','dsn=MySQL2000;User
Id=sa;Password=Password!01').Northwind.dbo.Categor ies
Hope this helps. If you have any other questions or concerns, please feel
free to let me know.
Have a good day!
Charles Wang
Microsoft Online Community Support
================================================== ===
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
================================================== ====
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
|||Hi,
I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
Have a good day!
Charles Wang
Microsoft Online Community Support
================================================== ====
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

OpenDataSource with Microsoft.Jet.OLEDB.4 Excel from stored proced

I have a stored procedure which has the following line:
select * from FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="\\MachineName\shared\account.xls";...Excel 8.0...
This stored procedure was called from a VB application. It's odd that
ONLY when ADO connection user need SA database role
AND \\MachineName\shared\account.xls was physical located in the same
machine of DATABASE
the stored procedure would work.
Otherwise it returned error like:
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
IDBInitialize::Initialize returned 0x80004005: The provider did not give an
y
information about the error.]. 0 7300 -2147217900 Microsoft OLE DB Provider
for SQL Server 01000OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an
error. The provider did not give any information about the error. 0 7399
-2147217900 Microsoft OLE DB Provider for SQL Server 42000
Database is SQL Server 2000 SP4. Registry DisallowAdhocAccess is 0.
Any suggestion?Because the security reson, I don't want ADO connection user has the SA role
,
and Excel file can located in any shared folder in the LAN.
"david" wrote:

> I have a stored procedure which has the following line:
> select * from FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="\\MachineName\shared\account.xls";...Excel 8.0...
> This stored procedure was called from a VB application. It's odd that
> ONLY when ADO connection user need SA database role
> AND \\MachineName\shared\account.xls was physical located in the same
> machine of DATABASE
> the stored procedure would work.
> Otherwise it returned error like:
> OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
> IDBInitialize::Initialize returned 0x80004005: The provider did not give
any
> information about the error.]. 0 7300 -2147217900 Microsoft OLE DB Provide
r
> for SQL Server 01000OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an
> error. The provider did not give any information about the error. 0 7399
> -2147217900 Microsoft OLE DB Provider for SQL Server 42000
> Database is SQL Server 2000 SP4. Registry DisallowAdhocAccess is 0.
> Any suggestion?
>sql

OpenDataSource with Microsoft.Jet.OLEDB.4 Excel from stored proced

I have a stored procedure which has the following line:
select * from FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="\\MachineName\shared\account.xls";...Excel 8.0...
This stored procedure was called from a VB application. It's odd that
ONLY when ADO connection user need SA database role
AND \\MachineName\shared\account.xls was physical located in the same
machine of DATABASE
the stored procedure would work.
Otherwise it returned error like:
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
IDBInitialize::Initialize returned 0x80004005: The provider did not give any
information about the error.]. 0 7300 -2147217900 Microsoft OLE DB Provider
for SQL Server 01000OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an
error. The provider did not give any information about the error. 0 7399
-2147217900 Microsoft OLE DB Provider for SQL Server 42000
Database is SQL Server 2000 SP4. Registry DisallowAdhocAccess is 0.
Any suggestion?Because the security reson, I don't want ADO connection user has the SA role,
and Excel file can located in any shared folder in the LAN.
"david" wrote:
> I have a stored procedure which has the following line:
> select * from FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="\\MachineName\shared\account.xls";...Excel 8.0...
> This stored procedure was called from a VB application. It's odd that
> ONLY when ADO connection user need SA database role
> AND \\MachineName\shared\account.xls was physical located in the same
> machine of DATABASE
> the stored procedure would work.
> Otherwise it returned error like:
> OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
> IDBInitialize::Initialize returned 0x80004005: The provider did not give any
> information about the error.]. 0 7300 -2147217900 Microsoft OLE DB Provider
> for SQL Server 01000OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an
> error. The provider did not give any information about the error. 0 7399
> -2147217900 Microsoft OLE DB Provider for SQL Server 42000
> Database is SQL Server 2000 SP4. Registry DisallowAdhocAccess is 0.
> Any suggestion?
>

OpenDataSource trouble with Advantage SQL

Hi folks.
I'm trying to connect to a Medisoft Advantage SQL db through SQL Server
using OpenDataSource or OpenRowSet. I have general connections to the db
working fine, but not with OpenDataSource or OpenRowSet.

I've tried variations on:

select * from
OpenDataSource(
'Advantage OLE DB Provider',
'Data Source=C:\MediData\Tutor\mwddf.add;
User ID=user;Password=password;
Advantage Server Type=ADS_LOCAL_SERVER;
Initial Catalog=mwddf.add;')...MWPAT

Which gives:
OLE DB error trace [OLE/DB Provider 'Advantage OLE DB Provider'
IColumnsInfo::MapColumnIDs returned 0x80040e21: [COLUMN_NAME=TABLE_CATALOG
ORDINAL=-1], [COLUMN_NAME=TABLE_SCHEMA ORDINAL=-1], [COLUMN_NAME=TABLE_NAME
ORDINAL=-1], [COLUMN_NAME=TABLE_TYPE ORDINAL=-1], [COLUMN_NAME=TABLE_GUID
ORDINAL=-1]].

I've also tried:

select * from
Openrowset(
'Advantage OLE DB Provider',
'Data Source=C:\MediData\Tutor\mwddf.add;User
ID=user;Password=password;Initial Catalog=mwddf.add;Advantage Server
Type=ADS_REMOTE_SERVER',
MWPAT)
and 'Select * from MWPAT'.
These last yield:

[OLE/DB provider returned message: No Data Source specified]

which seems closer.

Can anyone help? I think this is all Advantage-specific. I've posted on
their boards, but their not very active...

Thanks.

DavidHi David,

what is the version of database you are using. 6, 7.0, 7.1 or 8

thanks
vaddi

Quote:

Originally Posted by David Horowitz

Hi folks.
I'm trying to connect to a Medisoft Advantage SQL db through SQL Server
using OpenDataSource or OpenRowSet. I have general connections to the db
working fine, but not with OpenDataSource or OpenRowSet.

I've tried variations on:

select * from
OpenDataSource(
'Advantage OLE DB Provider',
'Data Source=C:\MediData\Tutor\mwddf.add;
User ID=user;Password=password;
Advantage Server Type=ADS_LOCAL_SERVER;
Initial Catalog=mwddf.add;')...MWPAT

Which gives:
OLE DB error trace [OLE/DB Provider 'Advantage OLE DB Provider'
IColumnsInfo::MapColumnIDs returned 0x80040e21: [COLUMN_NAME=TABLE_CATALOG
ORDINAL=-1], [COLUMN_NAME=TABLE_SCHEMA ORDINAL=-1], [COLUMN_NAME=TABLE_NAME
ORDINAL=-1], [COLUMN_NAME=TABLE_TYPE ORDINAL=-1], [COLUMN_NAME=TABLE_GUID
ORDINAL=-1]].

I've also tried:

select * from
Openrowset(
'Advantage OLE DB Provider',
'Data Source=C:\MediData\Tutor\mwddf.add;User
ID=user;Password=password;Initial Catalog=mwddf.add;Advantage Server
Type=ADS_REMOTE_SERVER',
MWPAT)
and 'Select * from MWPAT'.
These last yield:

[OLE/DB provider returned message: No Data Source specified]

which seems closer.

Can anyone help? I think this is all Advantage-specific. I've posted on
their boards, but their not very active...

Thanks.

David

OpenDataSource to Excel

OpenDataSource does not work:
SELECT * FROM
OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=c:\temp\TEST.XLS;Extended properties=Excel 5.0')...[Tabelle1$]
The error message is:
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)".
On our newest installation with Windows2003Server SP2 running with
SQLServer2005 SP2 the select-statement fails.
(On WindowsXP SP2 with SQLServer2005 SP2 its still working fine)
SQLServer-Service is running as a local-user that is an administrator
The user calling the select-statement is the same local-user
The Excel-File is on a local drive
Georg
Yes, I have seen this error many times and could not be able to solve the
problem. It worked just fine on SS2000 and does not on SS2005.
What if you create SSIS package to move the data?
"Georg" <Georg@.discussions.microsoft.com> wrote in message
news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
> OpenDataSource does not work:
> SELECT * FROM
> OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source=c:\temp\TEST.XLS;Extended properties=Excel
> 5.0')...[Tabelle1$]
> The error message is:
> 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)".
> On our newest installation with Windows2003Server SP2 running with
> SQLServer2005 SP2 the select-statement fails.
> (On WindowsXP SP2 with SQLServer2005 SP2 its still working fine)
> SQLServer-Service is running as a local-user that is an administrator
> The user calling the select-statement is the same local-user
> The Excel-File is on a local drive
>
>
|||Thank you for quick reply !
I'm afraid SSIS package is no solution for me...
"Uri Dimant" wrote:

> Georg
> Yes, I have seen this error many times and could not be able to solve the
> problem. It worked just fine on SS2000 and does not on SS2005.
> What if you create SSIS package to move the data?
>
> "Georg" <Georg@.discussions.microsoft.com> wrote in message
> news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
>
>
|||"Uri Dimant" <urid@.iscar.co.il> wrote in
news:OT1SVhsnIHA.5944@.TK2MSFTNGP03.phx.gbl:
[vbcol=seagreen]
> Georg
> Yes, I have seen this error many times and could not be able to solve
> the problem. It worked just fine on SS2000 and does not on SS2005.
> What if you create SSIS package to move the data?
>
> "Georg" <Georg@.discussions.microsoft.com> wrote in message
> news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
FWIW, the analogous
SELECT * FROM
OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=c:\Documents and Settings\Chris\My Documents\RSJ.xls;Extended
properties=Excel 5.0')...[Sheet1$]
works fine for me with SQL Server 2005 Express.
|||We could not reproduce the problem on a Test-Server with W2003Server/SP2 +
SS2005/SP2 - here it works fine also. Currently we try to find further
difference(s) between Test- and Production-Server
"Chris.Cheney" wrote:

> "Uri Dimant" <urid@.iscar.co.il> wrote in
> news:OT1SVhsnIHA.5944@.TK2MSFTNGP03.phx.gbl:
>
> FWIW, the analogous
> SELECT * FROM
> OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source=c:\Documents and Settings\Chris\My Documents\RSJ.xls;Extended
> properties=Excel 5.0')...[Sheet1$]
> works fine for me with SQL Server 2005 Express.
>

OpenDataSource to Excel

OpenDataSource does not work:
SELECT * FROM
OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=c:\temp\TEST.XLS;Extended properties=Excel 5.0')...[Tabelle1$]
The error message is:
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)".
On our newest installation with Windows2003Server SP2 running with
SQLServer2005 SP2 the select-statement fails.
(On WindowsXP SP2 with SQLServer2005 SP2 its still working fine)
SQLServer-Service is running as a local-user that is an administrator
The user calling the select-statement is the same local-user
The Excel-File is on a local driveGeorg
Yes, I have seen this error many times and could not be able to solve the
problem. It worked just fine on SS2000 and does not on SS2005.
What if you create SSIS package to move the data?
"Georg" <Georg@.discussions.microsoft.com> wrote in message
news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
> OpenDataSource does not work:
> SELECT * FROM
> OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source=c:\temp\TEST.XLS;Extended properties=Excel
> 5.0')...[Tabelle1$]
> The error message is:
> 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)".
> On our newest installation with Windows2003Server SP2 running with
> SQLServer2005 SP2 the select-statement fails.
> (On WindowsXP SP2 with SQLServer2005 SP2 its still working fine)
> SQLServer-Service is running as a local-user that is an administrator
> The user calling the select-statement is the same local-user
> The Excel-File is on a local drive
>
>|||Thank you for quick reply !
I'm afraid SSIS package is no solution for me...
"Uri Dimant" wrote:
> Georg
> Yes, I have seen this error many times and could not be able to solve the
> problem. It worked just fine on SS2000 and does not on SS2005.
> What if you create SSIS package to move the data?
>
> "Georg" <Georg@.discussions.microsoft.com> wrote in message
> news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
> > OpenDataSource does not work:
> >
> > SELECT * FROM
> > OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> > 'Data Source=c:\temp\TEST.XLS;Extended properties=Excel
> > 5.0')...[Tabelle1$]
> >
> > The error message is:
> > 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)".
> >
> > On our newest installation with Windows2003Server SP2 running with
> > SQLServer2005 SP2 the select-statement fails.
> > (On WindowsXP SP2 with SQLServer2005 SP2 its still working fine)
> >
> > SQLServer-Service is running as a local-user that is an administrator
> > The user calling the select-statement is the same local-user
> > The Excel-File is on a local drive
> >
> >
> >
>
>|||"Uri Dimant" <urid@.iscar.co.il> wrote in
news:OT1SVhsnIHA.5944@.TK2MSFTNGP03.phx.gbl:
> Georg
> Yes, I have seen this error many times and could not be able to solve
> the problem. It worked just fine on SS2000 and does not on SS2005.
> What if you create SSIS package to move the data?
>
> "Georg" <Georg@.discussions.microsoft.com> wrote in message
> news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
>> OpenDataSource does not work:
>> SELECT * FROM
>> OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
>> 'Data Source=c:\temp\TEST.XLS;Extended properties=Excel
>> 5.0')...[Tabelle1$]
FWIW, the analogous
SELECT * FROM
OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=c:\Documents and Settings\Chris\My Documents\RSJ.xls;Extended
properties=Excel 5.0')...[Sheet1$]
works fine for me with SQL Server 2005 Express.|||We could not reproduce the problem on a Test-Server with W2003Server/SP2 +
SS2005/SP2 - here it works fine also. Currently we try to find further
difference(s) between Test- and Production-Server
"Chris.Cheney" wrote:
> "Uri Dimant" <urid@.iscar.co.il> wrote in
> news:OT1SVhsnIHA.5944@.TK2MSFTNGP03.phx.gbl:
> > Georg
> > Yes, I have seen this error many times and could not be able to solve
> > the problem. It worked just fine on SS2000 and does not on SS2005.
> > What if you create SSIS package to move the data?
> >
> >
> > "Georg" <Georg@.discussions.microsoft.com> wrote in message
> > news:63193B94-1355-44C4-A38E-A645A3F343E1@.microsoft.com...
> >> OpenDataSource does not work:
> >>
> >> SELECT * FROM
> >> OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> >> 'Data Source=c:\temp\TEST.XLS;Extended properties=Excel
> >> 5.0')...[Tabelle1$]
> FWIW, the analogous
> SELECT * FROM
> OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source=c:\Documents and Settings\Chris\My Documents\RSJ.xls;Extended
> properties=Excel 5.0')...[Sheet1$]
> works fine for me with SQL Server 2005 Express.
>

OpenDataSource Quandary

I am trying to open and query a Microsoft Access "like" database from SQL Server 2000 using OpenDataSource. This will work for a little while, but if I am to update my ASP.NET code base I have to completely reboot the machine for these queries to work again. I also have two reboot the machine periodically because this functionality decides to crap out. I am doing this from a stored procedure. My code looks like this:

DECLARE @.SelectCode varchar(5000)
SET @.SelectCode =
'SELECT CONVERT(varchar, Value) AS UnitName FROM
OPENDATASOURCE(''Microsoft.Jet.OLEDB.4.0'', ''Data Source = "' + @.Path + @.DataFile + '.fcd";User ID=Admin;Password=;'')...Properties WHERE Property LIKE ''UnitName'''
EXEC(@.SelectCode)

Now, when I am developing on my local machine that uses Windows Authentication, I have absolutely no problems, unless the source file has a schema error.

Any ideas?

Hi jmace,

I've checked your code and didn't find any problems. One doubt here is that what a FCD file format is?(i've searched through google while didn't get enough valuable information).

It sounds to me that you are accessing this stored procedure from asp.net code, so, my suggestion is, can you try to execute it from your Management Studio directly and see if your problem still can be reproduced? This will help limit this problem. Also, check if it's the database itself's issue. Again, seems your code is fine.

Hope my suggestion helps

sql

OPENDATASOURCE Problems (permission)

Hi all,
I am running SQL2000 SP4 and want to run the command:
SELECT *
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
with members"
logged in as "sa" it is fine but when another user no "sa" runs I get:
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied.
You must access this provider through a linked server.
Can anyone help me? The user that will run that is not "sa"
thanks
JulioJulio
http://support.microsoft.com/kb/327489
"Julio Mattos" <JulioMattos@.discussions.microsoft.com> wrote in message
news:732AD50A-E369-49E4-AE60-A5256075C37B@.microsoft.com...
> Hi all,
> I am running SQL2000 SP4 and want to run the command:
> SELECT *
> FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
> Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
> with members"
> logged in as "sa" it is fine but when another user no "sa" runs I get:
> Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been
> denied.
> You must access this provider through a linked server.
> Can anyone help me? The user that will run that is not "sa"
> thanks
> Julio|||Hi Uri,
thanks for that, I created a new registry entry (DisallowAdHocAccess) under
'Microsoft Jet 4.0 OLE DB Provider' set to 0 and it's working fine. The key
is the DisallowAdHocAccess for each provider.
thanks
Julio M
"Uri Dimant" wrote:
> Julio
> http://support.microsoft.com/kb/327489
>
> "Julio Mattos" <JulioMattos@.discussions.microsoft.com> wrote in message
> news:732AD50A-E369-49E4-AE60-A5256075C37B@.microsoft.com...
> > Hi all,
> >
> > I am running SQL2000 SP4 and want to run the command:
> >
> > SELECT *
> > FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
> > Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
> > with members"
> >
> > logged in as "sa" it is fine but when another user no "sa" runs I get:
> >
> > Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been
> > denied.
> > You must access this provider through a linked server.
> >
> > Can anyone help me? The user that will run that is not "sa"
> >
> > thanks
> > Julio
>
>

OPENDATASOURCE Problems (permission)

Hi all,
I am running SQL2000 SP4 and want to run the command:
SELECT *
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
with members"
logged in as "sa" it is fine but when another user no "sa" runs I get:
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied.
You must access this provider through a linked server.
Can anyone help me? The user that will run that is not "sa"
thanks
Julio
Julio
http://support.microsoft.com/kb/327489
"Julio Mattos" <JulioMattos@.discussions.microsoft.com> wrote in message
news:732AD50A-E369-49E4-AE60-A5256075C37B@.microsoft.com...
> Hi all,
> I am running SQL2000 SP4 and want to run the command:
> SELECT *
> FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
> Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
> with members"
> logged in as "sa" it is fine but when another user no "sa" runs I get:
> Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been
> denied.
> You must access this provider through a linked server.
> Can anyone help me? The user that will run that is not "sa"
> thanks
> Julio
|||Hi Uri,
thanks for that, I created a new registry entry (DisallowAdHocAccess) under
'Microsoft Jet 4.0 OLE DB Provider' set to 0 and it's working fine. The key
is the DisallowAdHocAccess for each provider.
thanks
Julio M
"Uri Dimant" wrote:

> Julio
> http://support.microsoft.com/kb/327489
>
> "Julio Mattos" <JulioMattos@.discussions.microsoft.com> wrote in message
> news:732AD50A-E369-49E4-AE60-A5256075C37B@.microsoft.com...
>
>

OPENDATASOURCE Problems (permission)

Hi all,
I am running SQL2000 SP4 and want to run the command:
SELECT *
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
with members"
logged in as "sa" it is fine but when another user no "sa" runs I get:
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied.
You must access this provider through a linked server.
Can anyone help me? The user that will run that is not "sa"
thanks
JulioJulio
http://support.microsoft.com/kb/327489
"Julio Mattos" <JulioMattos@.discussions.microsoft.com> wrote in message
news:732AD50A-E369-49E4-AE60-A5256075C37B@.microsoft.com...
> Hi all,
> I am running SQL2000 SP4 and want to run the command:
> SELECT *
> FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data
> Source="f:\jackpot\jackpot.mdb"; User ID=Admin;Password=')..."master table
> with members"
> logged in as "sa" it is fine but when another user no "sa" runs I get:
> Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been
> denied.
> You must access this provider through a linked server.
> Can anyone help me? The user that will run that is not "sa"
> thanks
> Julio|||Hi Uri,
thanks for that, I created a new registry entry (DisallowAdHocAccess) under
'Microsoft Jet 4.0 OLE DB Provider' set to 0 and it's working fine. The key
is the DisallowAdHocAccess for each provider.
thanks
Julio M
"Uri Dimant" wrote:

> Julio
> http://support.microsoft.com/kb/327489
>
> "Julio Mattos" <JulioMattos@.discussions.microsoft.com> wrote in message
> news:732AD50A-E369-49E4-AE60-A5256075C37B@.microsoft.com...
>
>

Opendatasource problem

hi to every one...

To delete records in tableA which is not found in tableB i am using the following :
DELETE tableA from tableA aa left join tableB bb on aa.fld = bb.fld where bb.fld is null
** This will work fine **
but if i Use similer but using OPENDATASOURCE , like this:

delete OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\temp\data2004.mdb";
User ID="Admin";Password="";Jet OLEDB:Database Password="lea"')...tableA
from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\temp\data2004.mdb";
User ID="Admin";Password="";Jet OLEDB:Database Password="lea"')...tableA aa left join tableB bb on aa.lno=ba.lno where b.lno is null

the result is deleteing whole of TableA....

any help is appriciated
Thanks.Does this syntax work?:

delete
from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\temp\data2004.mdb";
User ID="Admin";Password="";Jet OLEDBatabase Password="lea"')...tableA aa left join tableB bb on aa.lno=ba.lno where b.lno is null|||this will not work , it will give the following error:

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near 'aa'.

OpenDataSource Problem

begin
select @.datasource = 'Data Source="c:/'
+@.FOLDERNAME
+'/'
+@.FILENAME
+'";User ID=;Password=;Extended properties=Excel 5.0'
select
*
into
#excel_table
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', @.DATASOURCE)...sheet1$
end

need to do this ... but using variables in opendatasource not allowed.

so how do we go about it

What i need to do is allow upload of any excel file ... may contain errors and then perform some checks on the data before putting it into another table with a fixed structure.select @.query ='create procedure sp_excel_upload as select
*
into
excel_table
from OpenDataSource( '+''''+'Microsoft.Jet.OLEDB.4.0'+''''+','+''''+'Da ta Source="'
+@.FOLDERNAME
+@.FILENAME
+'";User ID=;Password=;Extended properties=Excel 5.0'+'''' + ')...sheet1$'
exec (@.query)
exec sp_excel_upload
/* put checks here */
select * into final_table from excel_table
drop procedure sp_excel_upload
drop table excel_table

How much performance overhead would this approach add on say about 40 files daily ?

Any ideas ??|||Guys .. Gurus ...

Nobody has any thoughts about this ??sql

Opendatasource for text file

Ok .. Gurus ... here's my problem

I am able to successfully run a opendatasource query against a flat file from SQL Server. However the problem I am facing is that the resultset that is returned has a line as one column and one row ... is there any way i can get the opendatasource query to recognize tabs as column seperators ??Why not just bcp it in to a table?|||coz brett .. i ve got a huge problem with BCP ...

It needs a table structure to be defined ... and i dont have that luxury ... I need to take any flat file ... check if it meets my requirements and if it does only then load it into a table ... otherwise display an error...

The data files are going to come in from different locations ... either as a flat file or as a excel file ... dont have control on that ... have got to check the files coming in for different validity criterion ...

The files coming in might be having more columns than needed ... and i need to ignore those.

Hope you get an idea of the mess I am in ... need help desperately ...|||EXCEL or csv?

BIG difference...

I would think about this

CREATE TABLE myTable99(Col1 varchar(8000))
GO

And bcp everything in to that...then interogate the data...

and you say you have a final destination table anyway...

how do get the data from these different source to match in tyhe first place...do they all have different layouts?

How do you know what layout to use?

Do you want the pong software back for your new laptop?|||Either Excel or Tab Delimited Excel file ...

And bcp everything in to that...then interogate the data...

same thing as using a linked server ... forgetting about the performance part ...

final destination table is defined but data is going to come from different sales people ... some have access .. some have msde ... some have excel ...

heres what i have till now

CREATE TABLE [File_Column_Format] (
[DataSource] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ColName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[DataType] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[length] [int] NULL ,
CONSTRAINT [PK_File_Column_Format] PRIMARY KEY CLUSTERED
(
[DataSource],
[ColName]
) ON [PRIMARY]
) ON [PRIMARY]
GO

CREATE TABLE [FileNameFormats] (
[DataSource] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Format_type] [varchar] (256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

These are the tables i am using to define what I want ... and validate the files I m being sent ... i can validate the excel files using this method ... but what about flat text files ?|||Are you using a config table to define the different file structures?

Also, How many different people?

Can't you just distribute an Access database and have it create the same csv file from everyone?

What a nightmare...

My sympathies...|||Originally posted by Brett Kaiser
Are you using a config table to define the different file structures?


Not for file structures .. but only for the table that the data is going into ... if any of the fields do not match the datatype or size described for it ... throw an error expressing .. row no and col no.
Originally posted by Brett Kaiser
Also, How many different people?

Say about 250

Originally posted by Brett Kaiser
Can't you just distribute an Access database and have it create the same csv file from everyone?

Can you elaborate on that ?

Originally posted by Brett Kaiser
What a nightmare...


[Wakes Up] Scream [/Wakes up]

[Goes back to sleep]zzzzzzzzzz[/Goes back to sleep]
Originally posted by Brett Kaiser
My sympathies...

Really need that ... and I thought ETL was easy :)|||I would just recreate the final destination table in Access...give them a form...so they can do their data entry...have Access export the data as a csv...place the mdb in a read only folder on the server

let them get copies from that location...have a single location that the need to deliver the data..

(they're mailing it to you right?)

That way they can't screw it up...because they will

OpenDataSource "Unspecified Error" connecting to Excel file

OpenDataSource gives "Unspecified Error" when connecting to local Excel
spreadsheet file with account not in local administrators group, on
Microsoft Windows 2003 / Microsoft SQL Server 2000 sp3a.
I am having a permissions problem using the OpenDataSource command to open
an Excel spreadsheet located on our Sql Server. The query is as follows:
SELECT * FROM opendatasource('Microsoft.Jet.OLEDB.4.0', 'Data
Source="C:\myPath\tempExcel.xls";User ID=Admin;Password=;Extended
properties=Excel 8.0')...['US Mail$'] tblImport
As you can see, the file is on the local Sql Server. All domain users have
full control to the myPath directory. The Sql Server service (and Sql
Server agent service) is running as the domain administrator account. We
are using integrated security to authenticate with the Sql Server. I even
tried setting up the proxy account as the domain administrator thinking that
maybe the opendatasource would use that.
The error I get when running this query on a remote machine as a domain user
through Query Analyzer is "Unspecified Error" in the Jet Initialization.
Even if I add domain users to the server administrator role, I still get the
error. However, if I add that domain users account to the local
administrators group on the Sql Server, the query works. I know this is not
an NTFS permission issue, as I have auditing turned on and there are no
object security failures in the event logs.
So my question is: what specific permissions are required for a domain user
to run an OpenDataSource query like this without having to add them to the
local administrators group on the Sql Server? Having to add the domain
users that need to run this query to the Sql Servers local administrators
group is simply unacceptable...
Thanks,
Frank Jones
Hi Frank,
From your descriptions, I understood that your non-admin users are not able
to execute OpenDataSource with the error message "Unspecified Error" while
only those who have system admin permissions could do it. Have I understood
you? Correct me if I was wrong.
First of all, please make sure your domain users have the access permission
to the following Registry Key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<Instance
Name>\Providers\Microsoft.Jet.OLEDB.4.0
value must not exist or be 1.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ Providers\Microsoft.Jet.OL
EDB.4.0
DisallowAdhocAccess = 0 should be added to allow access.
NOTE that you *must* Reboot the server for these registry changes to take
effect.
Secondly, please make sure your users have access permission to
C:\WINDOWS\system32\msjet40.dll and its folder
If all above does not work, I would like to suggest you using Regmon to
monitor which registry key was checked and denied for your domain users
with the following steps
1. Select the correct version for your Regmon and then download it from the
web site below
http://www.sysinternals.com/ntw2k/source/regmon.shtml
2. Install Regmon
3. Login as member of Local Administrator,
Start Regmon
Run the T-SQL command
Stop Regmon
Save the file as file1
4. Login as member of non-Administrator
Start Regmon
Run the T-SQL command
Stop Regmon
Save the file as file2
Compare the difference between file1 and file2, give the permissions to
those ACCESSDENY keys to non-admin users.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

OpenDataSource "Unspecified Error" connecting to Excel file

OpenDataSource gives "Unspecified Error" when connecting to local Excel
spreadsheet file with account not in local administrators group, on
Microsoft Windows 2003 / Microsoft SQL Server 2000 sp3a.
I am having a permissions problem using the OpenDataSource command to open
an Excel spreadsheet located on our Sql Server. The query is as follows:
SELECT * FROM opendatasource('Microsoft.Jet.OLEDB.4.0', 'Data
Source="C:\myPath\tempExcel.xls";User ID=Admin;Password=;Extended
properties=Excel 8.0')...['US Mail$'] tblImport
As you can see, the file is on the local Sql Server. All domain users have
full control to the myPath directory. The Sql Server service (and Sql
Server agent service) is running as the domain administrator account. We
are using integrated security to authenticate with the Sql Server. I even
tried setting up the proxy account as the domain administrator thinking that
maybe the opendatasource would use that.
The error I get when running this query on a remote machine as a domain user
through Query Analyzer is "Unspecified Error" in the Jet Initialization.
Even if I add domain users to the server administrator role, I still get the
error. However, if I add that domain users account to the local
administrators group on the Sql Server, the query works. I know this is not
an NTFS permission issue, as I have auditing turned on and there are no
object security failures in the event logs.
So my question is: what specific permissions are required for a domain user
to run an OpenDataSource query like this without having to add them to the
local administrators group on the Sql Server? Having to add the domain
users that need to run this query to the Sql Servers local administrators
group is simply unacceptable...
Thanks,
Frank JonesHi Frank,
From your descriptions, I understood that your non-admin users are not able
to execute OpenDataSource with the error message "Unspecified Error" while
only those who have system admin permissions could do it. Have I understood
you? Correct me if I was wrong.
First of all, please make sure your domain users have the access permission
to the following Registry Key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Mi
crosoft SQL Server\<Instance
Name>\Providers\Microsoft.Jet.OLEDB.4.0
value must not exist or be 1.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MS
SQLServer\Providers\Microsoft.Jet.OL
EDB.4.0
DisallowAdhocAccess = 0 should be added to allow access.
NOTE that you *must* Reboot the server for these registry changes to take
effect.
Secondly, please make sure your users have access permission to
C:\WINDOWS\system32\msjet40.dll and its folder
If all above does not work, I would like to suggest you using Regmon to
monitor which registry key was checked and denied for your domain users
with the following steps
1. Select the correct version for your Regmon and then download it from the
web site below
http://www.sysinternals.com/ntw2k/source/regmon.shtml
2. Install Regmon
3. Login as member of Local Administrator,
Start Regmon
Run the T-SQL command
Stop Regmon
Save the file as file1
4. Login as member of non-Administrator
Start Regmon
Run the T-SQL command
Stop Regmon
Save the file as file2
Compare the difference between file1 and file2, give the permissions to
those ACCESSDENY keys to non-admin users.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

Opendatasource

I was able to use the following select qry with an OpenDataSource, but I
recieve and error when I change it to an Update qry.
SELECT *
FROM OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0',
'Data Source="\\Posiden\apps\Access\MsData\holdbk.mdb";
User ID=Admin;Password='
)...[HoldOrderDetails_View] h,BoxIdCount b
Where h.[Line#]= b.BoxId and b.Task = 1
but when I change it to and Update it errors out. See code below
update h
set h.LOCATION = b.Location
FROM OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0',
'Data Source="\\Posiden\apps\Access\MsData\holdbk.mdb";
User ID=Admin;Password='
)...[HoldOrderDetails_View] h,BoxIdCount b
Where h.[Line#]= b.BoxId and b.Task = 1
I get the following error; Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'h'.
Any suggestions.
Thank you in advance for your helpdouble post by mistake?
"bhorwitz" <bhorwitz@.discussions.microsoft.com> wrote in message
news:33E09107-36E6-4131-A5F8-7D1053521CD3@.microsoft.com...
> I was able to use the following select qry with an OpenDataSource, but I
> recieve and error when I change it to an Update qry.
> SELECT *
> FROM OPENDATASOURCE(
> 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="\\Posiden\apps\Access\MsData\holdbk.mdb";
> User ID=Admin;Password='
> )...[HoldOrderDetails_View] h,BoxIdCount b
> Where h.[Line#]= b.BoxId and b.Task = 1
> but when I change it to and Update it errors out. See code below
> update h
> set h.LOCATION = b.Location
> FROM OPENDATASOURCE(
> 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="\\Posiden\apps\Access\MsData\holdbk.mdb";
> User ID=Admin;Password='
> )...[HoldOrderDetails_View] h,BoxIdCount b
> Where h.[Line#]= b.BoxId and b.Task = 1
> I get the following error; Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'h'.
> Any suggestions.
> Thank you in advance for your help|||try this..
untested..
update h
set LOCATION = b.Location
FROM OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0',
'Data Source="\\Posiden\apps\Access\MsData\holdbk.mdb";
User ID=Admin;Password='
)...[HoldOrderDetails_View] h,BoxIdCount b
Where h.[Line#]= b.BoxId and b.Task = 1

Opendatasource

I'm trying to use OPENDATASOURCE in t-sql to update data on our AS/400 from MSSQL but don't know the property value for provider_name. Please help!!!"Control Panel"\"Administrative Tools"\"Data Sources(ODBC)"
Select a tab "File DSN", click "Add..", select server and click "Advanced".
Now you see sub-driver for ODBC (MSDASQL)

For MS SQL Server in MS SQL Server
select *
from OpenRowset('MSDASQL', 'Driver={SQL Server};Server=MyServer;User=MyUser','select * from sysobjects')

I do not have A/400 driver installed, that is why I cannot test this for A/400.

Good luck !|||my diagnosis is the your transactional properties of your neural defilibrator is going to require that you just replace the AS400 with SQL Server.

you better get to work.sql

Opendatasource

What is the syntax for using parameters in an opendatasource query? I tried using the below:

SELECT top 10 *
FROM OPENDATASOURCE(
'SQLOLEDB',
'Data Source=10.22.10.78;User ID='+@.user+';Password='+@.pword
).Northwind.dbo.Categoriesad-hoc (i.e. openquery/openrowset/opendatasource) only accepts string literals. You have to formulate your entire opendatasource query and execute it.

e.g.
set @.sql='select *
from opendatasource(...)'

exec(@.sql)|||Nothing really happens when I try to exec the following, Is my syntax correct?:

Declare @.user as varchar(25)
Declare @.pword as varchar(25)
Declare @.Cstring as varchar(500)

Set @.cString = 'SELECT top 10 SOPNUMBE, TRXDATE, LNITMSEQ, [DB_ID], AccountId, XTNDPRCE
FROM OPENDATASOURCE(
' + 'SQLOLEDB' + ',' +
'Data Source=server1;User ID=' + @.user + ';Password=' + @.pword + '
).dw1.dbo.Table1'

exec (@.cstring)|||Wasn't entering the username and password. Is there a way to make this an Insert statement?|||insert into what? like this?

--set @.sql='your select query'

insert tb
exec(@.sql)