Re: **different place for creating a new table**

From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 06/06/04


Date: Sun, 6 Jun 2004 10:02:45 -0500

Both the Enterprise Manager and Query Analyzer tools allow you to specify
the desired owner when you create a table. The difference is that EM always
specifies the owner explicitly in its internally generated script but QA
lets you enter free-form DDL. Since you omitted the owner in the script you
executed in QA, the SQL Server default owner was used.

If you want to create the tables using QA the same way EM does, specify the
desired owner explicitly like the example below. This is a good practice
since it avoids the ambiguity you've encountered.

CREATE TABLE dbo.T1
(
    MyColumn int NOT NULL
)

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"RM" <m_r1824@yahoo.co.uk> wrote in message
news:opr85w1bwihqligo@msnews.microsoft.com...
> so when I use a dbowner "L1" login  in query analyzer,
> why my table saves with the name of "L1.T1"?
> if the member of db_owner can create table with
> their names or with static name called dbo,it should
> be the same in these 2 enviroments (Query Analyzer,Enterprise manager)
> isn't it logic?
>
> On Sun, 6 Jun 2004 09:38:55 +0200, Uri Dimant <urid@iscar.co.il> wrote:
>
> > RM
> > BOL says:
> > Only objects created by members of the sysadmin fixed server role (or by
> > the
> > dbo user) belong to dbo. Objects created by any other user who is not
> > also a
> > member of the sysadmin fixed server role (including members of the
> > db_owner
> > fixed database role):
> >
> >   a.. Belong to the user creating the object, not dbo.
> >
> >
> >   b.. Are qualified with the name of the user who created the object.
> > "RM" <m_r1824@yahoo.co.uk> wrote in message
> > news:opr85p4f08hqligo@msnews.microsoft.com...
> >> hi
> >>
> >> I want to create a new table "T1" in my database called "db1" in SQL
> >> server 2000 with a db_owner user,("L1","U1")
> >> I did it successfully in 2 ways ,but there was a difference in result:
> >> 1) I created in enterprise manager
> >> as I logined with L1 ,and when I saw T1 in
> >> query analyzer table list in db1 it was in shape
> >> of "dbo.t1".
> >> 2) I created it programatically as I logined
> >> with L1 in query analyzer and the shape of
> >> result appearred in table list of db1 in left
> >> window of query analyzer was "L1.t1".
> >> why??????
> >> what's the difference?
> >> why when I logined in enterprise manager as
> >> L1,it saved my table as dbo?
> >>
> >> any help would be greatly appreciated.
> >
> >
>


Relevant Pages

  • Re: Different ownership of objects for same user
    ... dbo.xxx, whereas when you created the other one, you did not specify the ... owner -- create object xxx. ... > I logged into enterprise manager as user 'UA' and created a table via ... I saw the owner- dbo. ...
    (microsoft.public.sqlserver.programming)
  • Re: Missing table
    ... execute the commands within Query Analyzer. ... The first piece of sql displays the table owner, type, and the name of the table. ...
    (microsoft.public.sqlserver.server)
  • Re: Bulk Insert Problem?
    ... i tried the query analyzer with the same insert statement when i ... > must specify the individual column names since this table is part of an ... > RDA replication ... >> when i want to update these rows from my remote server running on windows ...
    (microsoft.public.sqlserver.ce)
  • Re: DMO SQLServer->Connect failed for user name with special characters
    ... in Enterprise Manager or Query Analyzer I get the same error. ... > Also try to put quotes around the user name (try both single quotes and ... >>> Eclipsys Corporation ...
    (microsoft.public.sqlserver.connect)
  • Re: Cannot connect to Query Analyzer
    ... And what happens if while you are in Enterprise Manager, ... go to the menu to Tools and then select Query Analyzer? ... noticed that I could not open Query Analyzer from within Enterprise Manager. ... to be able to change the password on my local sql server? ...
    (microsoft.public.sqlserver.connect)