 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
Popup population |
|
After typing SELECT the popup is already filled by schemas, built-in functions, databases, variables, etc. and by objects from 'dbo' schema. Objects from other schemas can be accessed by selecting their schem with the right arrow and filtering further. This is very easy when the schema of the object is known but it makes looking for an object with unknown schema less than optimal. Is there a way (e.g. by altering DB Queries or something) to make the initial popup contain all the objects of the different schemas with their schema indicated as a separate column in the popup? Or at least (if it would make things slow), make it populate the list from the user's default schema instead of 'dbo'.
EDIT: I've just noticed that it does get populated from the user's default schema. Except when the login of the user has sysadmin role assigned to it. It seems that using such a login to connect to the database will always result in username being 'dbo' with the default schema 'dbo', hence the popup contains objects from 'dbo' as well. It looks like there is some kind of inconsistency in how SQL Server handles logins with sysadmin role :(
|
|
Fri Sep 14, 2012 4:41 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The current schema is derived from "Context" query. Please note it uses ISNULL(SCHEMA_NAME(), ''dbo'')') to get the current schema name. You may want to tweak this query to do a better work for you.
|
|
Fri Sep 14, 2012 6:39 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Thanks for the info. I modified Context to
 |
 |
SELECT
SERVERPROPERTY( 'ServerName' )
,SYSTEM_USER
,DB_NAME()
,COALESCE(
(
SELECT
dp.default_schema_name
FROM
sys.database_principals AS dp
WHERE 1 = 1
AND dp.principal_id = USER_ID( SYSTEM_USER )
)
,SCHEMA_NAME()
,'dbo'
)
|
so that it retrieves the default schema instead of 'dbo' for logins with sysadmin role. It seemed to work until I got some objects created in dbo schema, after which they were added to the popup even if the default schema was other than 'dbo' and selecting them from the popup prefixed them with the default schema instead of 'dbo'. I guess I'll just restore the original Context. It's not that important at all.
|
|
Sun Sep 16, 2012 2:29 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|