Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Avoid using dbname.userid.tablename syntax? 1

Status
Not open for further replies.

Ime532

IS-IT--Management
Apr 1, 2004
89
US
I wrote a bunch of code with queries that only specify the table name, without the prefixes. I was using sysdba as the user id in the connection string. Now I am using sa and I think that's the reason it wants me to reference a table in the format dbname.userid.tablename. My questions are:

1. Is this the reason it wants me to include prefixes?

2. Is there any way to connect using the sa account but avoid needing to use the prefixes?

Thanks.
 
Well i setup a sysdba user and it's still wanting me to use the prefixes. Any way in the connection string I can prevent this?
 
Or maybe there is a setting on the sql server that allows you to omit the prefixes (something like "Force fully qualified table names")?
 
You shouldn't have a problem as long as the objects and the user default schema are the same.

if the user creating the object has a default schema of dbo, then that't the prefix associated with the object.

if the user's default schema is their name, then you must reference the table as dbo.table
if the users default is dbo, then you do not need to specify it.

Unless you are using schemas to map permissions, the users should have their default schema set to the standard dbo.

Lodlaiden

You've got questions and source code. We want both!
 
Bingo, figured it out just as you replied! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top