Home All Groups Group Topic Archive Search About


Author
24 Jun 2009 2:29 PM
geebee
hi
I have a SQL server 2005 query and I am trying to refer to an ms access
table to use in the query. I cannot create a table or view in SQL server
because its note server. What would be the best solution to refer tonthe ms
access table (the max from a column) from within my SQL server query. Thanks
in advance.

Geebee

Author
24 Jun 2009 2:40 PM
Tom Moreau
You'll need to create a linked server:

EXEC sp_addlinkedserver
   @server = 'NWind',
   @provider = 'Microsoft.Jet.OLEDB.4.0',
   @srvproduct = 'OLE DB Provider for Jet',
   @datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
GO... and then access the table using 4-part naming:

SELECT *
FROM Nwind...Employees

--
   Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
news:817A357E-4E54-46FA-8CC6-84FE996AF96F@microsoft.com...
hi
I have a SQL server 2005 query and I am trying to refer to an ms access
table to use in the query. I cannot create a table or view in SQL server
because its note server. What would be the best solution to refer tonthe ms
access table (the max from a column) from within my SQL server query. Thanks
in advance.

Geebee
Are all your drivers up to date? click for free checkup

Author
24 Jun 2009 2:53 PM
geebee
Show quote Hide quote
"Tom Moreau" wrote:

> You'll need to create a linked server:
>
> EXEC sp_addlinkedserver
>    @server = 'NWind',
>    @provider = 'Microsoft.Jet.OLEDB.4.0',
>    @srvproduct = 'OLE DB Provider for Jet',
>    @datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
> GO... and then access the table using 4-part naming:
>
> SELECT *
> FROM Nwind...Employees
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
> news:817A357E-4E54-46FA-8CC6-84FE996AF96F@microsoft.com...
Create linked server in access? I am new to this so I was wondering if I
could get some detailed steps. Thanks in advance


Show quoteHide quote
> hi
> I have a SQL server 2005 query and I am trying to refer to an ms access
> table to use in the query. I cannot create a table or view in SQL server
> because its note server. What would be the best solution to refer tonthe ms
> access table (the max from a column) from within my SQL server query. Thanks
> in advance.
>
> Geebee
>
>
Author
24 Jun 2009 10:27 PM
Tom Moreau
No.  You create the linked server in SQL Server and then run queries against
your Access database from there.

--
   Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


Show quoteHide quote
"geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
news:45AAF87D-5F5C-41E3-9CE8-B1399CC53283@microsoft.com...


"Tom Moreau" wrote:

> You'll need to create a linked server:
>
> EXEC sp_addlinkedserver
>    @server = 'NWind',
>    @provider = 'Microsoft.Jet.OLEDB.4.0',
>    @srvproduct = 'OLE DB Provider for Jet',
>    @datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
> GO... and then access the table using 4-part naming:
>
> SELECT *
> FROM Nwind...Employees
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
> news:817A357E-4E54-46FA-8CC6-84FE996AF96F@microsoft.com...
Create linked server in access? I am new to this so I was wondering if I
could get some detailed steps. Thanks in advance


Show quoteHide quote
> hi
> I have a SQL server 2005 query and I am trying to refer to an ms access
> table to use in the query. I cannot create a table or view in SQL server
> because its note server. What would be the best solution to refer tonthe
> ms
> access table (the max from a column) from within my SQL server query.
> Thanks
> in advance.
>
> Geebee
>
>
Author
25 Jun 2009 2:04 PM
geebee
Show quote Hide quote
"Tom Moreau" wrote:

> No.  You create the linked server in SQL Server and then run queries against
> your Access database from there.
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
> news:45AAF87D-5F5C-41E3-9CE8-B1399CC53283@microsoft.com...
>
>
> "Tom Moreau" wrote:
>
> > You'll need to create a linked server:
> >
> > EXEC sp_addlinkedserver
> >    @server = 'NWind',
> >    @provider = 'Microsoft.Jet.OLEDB.4.0',
> >    @srvproduct = 'OLE DB Provider for Jet',
> >    @datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
> > GO... and then access the table using 4-part naming:
> >
> > SELECT *
> > FROM Nwind...Employees
> >
> > --
> >    Tom
> >
> > ----------------------------------------------------
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> > SQL Server MVP
> > Toronto, ON   Canada
> > https://mvp.support.microsoft.com/profile/Tom.Moreau
> >
> >
> > "geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
> > news:817A357E-4E54-46FA-8CC6-84FE996AF96F@microsoft.com...
> Create linked server in access? I am new to this so I was wondering if I
> could get some detailed steps. Thanks in advance
>
>
> > hi
> > I have a SQL server 2005 query and I am trying to refer to an ms access
> > table to use in the query. I cannot create a table or view in SQL server
> > because its note server. What would be the best solution to refer tonthe
What do you mean by "4-part naming"?



Show quoteHide quote
> > ms
> > access table (the max from a column) from within my SQL server query.
> > Thanks
> > in advance.
> >
> > Geebee
> >
> >
>
>
Author
25 Jun 2009 4:32 PM
Tom Moreau
4-part naming means you have to use 4 parts when you refer to an object,
each part delimited by a dot.  Here's an example:

SELECT *
FROM Nwind...Employees

In this case, two parts are left out but the delimiters are still present.
From left to right, you have:

Server
Catalog (a.k.a. Database)
Schema (Owner in SQL 2000 and earlier)
Object

--
   Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


Show quoteHide quote
"geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
news:8424B6EE-E257-4CB4-9036-6D6F51C9B989@microsoft.com...


"Tom Moreau" wrote:

> No.  You create the linked server in SQL Server and then run queries
> against
> your Access database from there.
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
> news:45AAF87D-5F5C-41E3-9CE8-B1399CC53283@microsoft.com...
>
>
> "Tom Moreau" wrote:
>
> > You'll need to create a linked server:
> >
> > EXEC sp_addlinkedserver
> >    @server = 'NWind',
> >    @provider = 'Microsoft.Jet.OLEDB.4.0',
> >    @srvproduct = 'OLE DB Provider for Jet',
> >    @datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
> > GO... and then access the table using 4-part naming:
> >
> > SELECT *
> > FROM Nwind...Employees
> >
> > --
> >    Tom
> >
> > ----------------------------------------------------
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> > SQL Server MVP
> > Toronto, ON   Canada
> > https://mvp.support.microsoft.com/profile/Tom.Moreau
> >
> >
> > "geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
> > news:817A357E-4E54-46FA-8CC6-84FE996AF96F@microsoft.com...
> Create linked server in access? I am new to this so I was wondering if I
> could get some detailed steps. Thanks in advance
>
>
> > hi
> > I have a SQL server 2005 query and I am trying to refer to an ms access
> > table to use in the query. I cannot create a table or view in SQL server
> > because its note server. What would be the best solution to refer tonthe
What do you mean by "4-part naming"?



Show quoteHide quote
> > ms
> > access table (the max from a column) from within my SQL server query.
> > Thanks
> > in advance.
> >
> > Geebee
> >
> >
>
>
Author
24 Jun 2009 2:58 PM
Uri Dimant
In addition to Tom's advise

SELECT   *
FROM  OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0',
'Data Source="C:\northwind.mdb";
User ID=Admin;Password='
)...Customers


Show quoteHide quote
"geebee" <geraldj***@hotmail.com(noSPAMs)> wrote in message
news:817A357E-4E54-46FA-8CC6-84FE996AF96F@microsoft.com...
> hi
> I have a SQL server 2005 query and I am trying to refer to an ms access
> table to use in the query. I cannot create a table or view in SQL server
> because its note server. What would be the best solution to refer tonthe
> ms
> access table (the max from a column) from within my SQL server query.
> Thanks
> in advance.
>
> Geebee

Bookmark and Share