Home All Groups Group Topic Archive Search About
Author
20 Jul 2006 6:23 PM
dev648237923
I can query who the current user is (sp_who or select current_user) -- is
there a a way to determine their default schema?

Thank you!

Author
20 Jul 2006 6:56 PM
David Browne
"dev648237923" <dev648237923@noemail.noemail> wrote in message
news:Ogi3SmCrGHA.4680@TK2MSFTNGP02.phx.gbl...
>I can query who the current user is (sp_who or select current_user) -- is
>there a a way to determine their default schema?
>

select default_schema_name
from sys.database_principals
where principal_id = user_id()
and type = 'U'

David
Author
20 Jul 2006 6:59 PM
Tom Cooper
Look at sp_helpuser.

Tom

Show quote
"dev648237923" <dev648237923@noemail.noemail> wrote in message
news:Ogi3SmCrGHA.4680@TK2MSFTNGP02.phx.gbl...
>I can query who the current user is (sp_who or select current_user) -- is
>there a a way to determine their default schema?
>
> Thank you!
>
Author
20 Jul 2006 7:01 PM
Kalen Delaney
Hi

How about this:

SELECT default_schema_name
FROM sys.database_principals
WHERE name = user_name()

--
HTH
Kalen Delaney, SQL Server MVP


Show quote
"dev648237923" <dev648237923@noemail.noemail> wrote in message
news:Ogi3SmCrGHA.4680@TK2MSFTNGP02.phx.gbl...
>I can query who the current user is (sp_who or select current_user) -- is
>there a a way to determine their default schema?
>
> Thank you!
>

AddThis Social Bookmark Button