Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1117
  • Last Modified:

SQL Server backend dbo table prefix

I have an Access 2010 frontend with an Access 2010 backend.   The IT dept took the Access backend and created a SQL Server backend.  When I OBDC to the new backend all the tables have a dbo prefix.  The Access frontend does not recognize the tables.  

When the Access backend is upsized into SQL server is there a way to not have the dbo prefix or will all the tables need to be individually renamed?
0
Sasha42
Asked:
Sasha42
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if the login you use has db_owner permissions, the dbo table prefixes should not be needed.
0
 
DultonCommented:
When the Access backend is upsized into SQL server is there a way to not have the dbo prefix or will all the tables need to be individually renamed?

If the front-end is using them via linked table references... they'll have to be renamed.
0
 
Gustav BrockCIOCommented:
Yes and no. You write a small function that loops the tabledefs and renames the dbo_sometablename tables to just sometablename.

/gustav
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
As gustav mentions you can just rename the tabledefs. Here's a simple code loop that will do so:

Dim tdf As DAO.TableDef
Dim dbs As DAO.Database

Set dbs = CurrentDB

For each tdf in dbs.TableDefs
  If Left(tdf.Name, 3) = "dbo" Then
    '/ the prefix is "dbo_", so we trim off the first 4
    tdf.Name = Right(tdf.Name, Len(tdf.Name-4)
  End If
Next
0
 
PatHartmanCommented:
The Access upsizing wizard takes care of this for you by removing the owner prefix in the final step when it relinks the upsized tables.  When you link manually, you need to fix the problem manually or by using the code posted by Scott.

You can use the following query to see the actual table name vs the local table name.  The Name column is the name of the table as you see it in the navigation pane.  The ForeignName is the name of the table as you see it in the remote database.  So after you run Scott's update procedure, this query will show you the changes.


SELECT MSysObjects.Connect, MSysObjects.Name, MSysObjects.ForeignName, MSysObjects.Type
FROM MSysObjects
WHERE (((MSysObjects.Type)=4));
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now