Why dbo_

G

Guest

I am using Access 2003 and SQL Server 2000. I created an SQL database using
the upsize wizard and connected to it. When I linked, all the tables were
prefixed with dbo_ For example tblPerson became dbo_tlbPerson. I can
rename them but as I plan to distribute the database, I was wondering if
there is anything I can do to overcome the issue.
 
D

Douglas J. Steele

In SQL Server, it's actually possible to have more than one table with the
same name, depending on who created them. I don't believe you can stop the
behaviour that qualifies the table with the owner name (in SQL Server, it
would have been dbo.tblPerson)

To automatically rename your tables, use:

Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef

Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
If Left$(tdfCurr.Name, 4) = "dbo_" Then
tdfCurr.Name = Mid$(tdfCurr.Name, 5)
End If
Next tdfCurr

Set dbCurr = Nothing
 
G

Guest

Thanks Douglas

I am struggling a bit with my first conversion to SQL. Have used Access
extensively but barely touched SQL Server. Guess I have a steep learning
curve. Your information is helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top