x
login about faq Site discussion (meta-askssc)

dbo schema not showing for tables when tables are created with SQL login

I create a table in sql server 2005 database table_1 with sql login "abc" and the table name appears as abc.Table_1, while if I create table on other 2005 server it appears as dbo.Table_1.

Is there any specific reason for this different behaviour.

sql logins at both the server has dbowner right.

more ▼

asked Apr 30 '10 at 12:28 PM in Default

Bhaskar gravatar image

Bhaskar
333 15 16 20

(comments are locked)
10|1200 characters needed characters left

1 answer: sort newest

On the first server the default schema for your user 'abc' is 'abc'.

On the second server the default schema for your user is 'dbo', (this is always the case when the user is the database owner).

more ▼

answered Apr 30 '10 at 12:34 PM

Kev Riley gravatar image

Kev Riley ♦♦
46.1k 38 43 69

thanks, I checked both the servers and they both have default schema 'abc'. It is really confusing, I missing something.

Apr 30 '10 at 12:43 PM Bhaskar

It is considered a dangerous practice not to specify schema when creating tables. If you would do the right thing then there will never be any ambiguity. In other words, the statement creating a table should look like create table [JO_SCHEMA].[JO_TABLE] rather than create table [JO_TABLE] – Oleg 0 secs ago

Apr 30 '10 at 12:49 PM Oleg

on the 2nd server is the user the database owner?

Apr 30 '10 at 12:49 PM Kev Riley ♦♦

Are you sure that the abc login is not sa on one of the servers but not the other. sa logins come in as dbo, this can make a difference.

Apr 30 '10 at 12:51 PM Oleg

That's the only difference you need to find....

Apr 30 '10 at 01:10 PM Kev Riley ♦♦
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1834
x29
x4

asked: Apr 30 '10 at 12:28 PM

Seen: 2110 times

Last Updated: May 02 '10 at 05:06 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.