Avatar of Volibrawl
Volibrawl

asked on 

How to Create view to Linked server table?

I used Mgmnt Studio to create a Linked Server which "links" to an Access mdb.  ( I think)

How do I create a view in an Access ADP to a table in the Linked Server.
How do I create a view in another SQL database to a table in the Linked Server.

I currently have this SQL statement which does not work.

SELECT TRACKDATA.cstrackdata.dbo.tbljob.*
FROM TRACKDATA.cstrackdata.dbo.tbljob


Trackdata:  Name of Linked Server
CStrackData:  Name of MDB file
tbljob:  Name of table in the mdb

I tried with / without the dbo

I have not done anything with DTC (ie have not turned it on or off in any way)


 
Microsoft AccessMicrosoft SQL Server

Avatar of undefined
Last Comment
rboyd56
ASKER CERTIFIED SOLUTION
Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of rboyd56
rboyd56

You can also use this:

select * from openquery(Trackdata,'select * from tbljob')

When you run SELECT * FROM LinkedServerName...TableName you will copy all the data from the table in the Access database before appying any where clause.

However, using the openquery function sends the query as a passthrough so all the work is done at the Access database and only the results are sent back.

If you are going to return all data from the view/table then it probably will not matter which one you use.
Avatar of Volibrawl
Volibrawl

ASKER

Thanks for the additional comment rboyd...

If I had a table with 100 fields, but I only need 3 would the second one of these be faster?

SELECT  Lastname, Firstname, Phone from ...ADDRESS

SELECT  * from openquery ('Select Lastname, Firstname, Phone from ...ADDRESS')
Avatar of Volibrawl
Volibrawl

ASKER

Corrected:

SELECT  * from openquery (trackdata, 'Select Lastname, Firstname, Phone from ADDRESS')



Avatar of rboyd56
rboyd56

Yes it would be faster because it would be returning less data.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo