Thursday, 24 September 2009

how to get the default schema for a user in MSSQL 2005

execute the stored procedure sp_helpuser, for example

sp_helpuser 'domainname\username'

One of the resulting columns is DefSchemaName.

There is a similar proc sp_helpgroup to show the users in a group but does not include schema information.

Another way to get the schema information is

select name, default_schema_namefrom sys.database_principals uwhere'username'

No comments: