Results 1 to 7 of 7

Thread: [RESOLVED] I need help with default schema

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Resolved [RESOLVED] I need help with default schema

    Hi!

    A user is complaining about a database I have set up. The setup is like this:

    I created a database A

    I created a login Donald
    I created a user Donald

    The user Donald has Donald as the default schema. So in database A all tables looks like this

    Donald.TableA
    Donald.TableB
    ...

    The login Donald is connected to the database A, user Donald and default schema Donald.

    The problem is that when the user log on , he must write

    select * from Donald.TableA Where.....

    He wants to write select * from TableA..


    I am rather new to SQL Server 2005, what have I missed here? I am using Management Studio..

    The connection stirng looks like this:
    Provider=SQLNCLI;Server=.\SQLEXPRESS;Database=A;User ID=Donald;Password=pass;Default Schema=Donald"

    kind regards
    Henrik
    Last edited by MrNorth; Oct 7th, 2008 at 08:31 AM.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: I need help with default schema

    Have they tried "select * from tableA" ? It works for me on our databases. But I did read some where that qualifying the table with the schema is better for performance?
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: I need help with default schema

    Hi!

    Yes that is the question he wants to run. But then he get a message stating that TableA doesn not exist, unknown object. But teh same questy when using Donald. in front of the table name works perfect.


    what have I missed?

    /HEnrik

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: I need help with default schema

    I think SQL Server always checks dbo for tables, other then that you need to put schema in
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: I need help with default schema

    Hi!

    Yes I think there is something with the dbo... any suggestion on how I should change it?

    kind regards
    Henrik

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: I need help with default schema

    I always put the schema name if the object is not in the dbo schema.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: I need help with default schema

    Ok!

    I solved the problem by manually change the ownership of the tables from Donald to dbo, now it works, thanks!

    /Henrik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width