 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
Parameter popup for system stored procedures |
|
Using
 |
 |
EXEC MASTER.sys.sp_addmessage |
the popup offers the parameters.
Using simply
 |
 |
EXEC sys.sp_addmessage |
it does not. Why? Should it not?
|
|
Wed Jun 02, 2010 3:46 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
If the current database is not the database hosting the referenced procedure, SQL Assistant is unable to locate that procedure. As a result, no parameter suggestions, code preview, and other context related prompts can be displayed for that procedure.
|
|
Wed Jun 02, 2010 8:43 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
It surely would not work with other databases but it is in master. It can be considered local since it is under Stored Procedures -> System Stored Procedures and it present in every database. It can also be called without qualifying the master database. I guess it is some kind of a link/shortcut. Whichever, it can be accessed/called locally. SQL Assistant is able to locate it (or at least it does show it in popup). It's the parameters that is missing.
|
|
Wed Jun 02, 2010 8:53 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
If you want, you can modify DB Queries for SQL Server in SQL Assistant options and add UNIONs for stored procedures in the master database. This way you can make it to display system procedure names and parameters from the mater database regardless of the current database context. In particular, you will need to modify "Objects (MSSQL)" and "Arguments (MSSQL)" queries
|
|
Wed Jun 02, 2010 9:15 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
I'm a bit confused now. It already listed sp_addmessage so it seems that unioning master to Objects is not necessary but unioning master to Arguments did not help. Am I doing something wrong?
|
|
Thu Jun 03, 2010 4:06 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
For some reasons the metadata for certain system procedures is not visible in non-master databases. See for yourself
 |
 |
SELECT a.name, c.*
FROM sys.all_objects a
JOIN sys.syscolumns c
ON c.id = a.object_id
WHERE a.name = 'sp_addmessage' |
vs.
 |
 |
SELECT a.name, c.*
FROM master.sys.all_objects a
JOIN master.sys.syscolumns c
ON c.id = a.object_id
WHERE a.name = 'sp_addmessage' |
In the Arguments query you cannot search arguments for an object in a master database using id of an object in the local database. That's why your modified query doesn't return the arguments if you make it use :OBJECT_ID . But you can search it by procedure name. Use :OBJECT_NAME variable, SQL Assistant will plug object name as a query parameter and that should work.
|
|
Thu Jun 03, 2010 9:00 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
So the popup did show sp_addmessage because its object_id was present in both the master and the non-master (and it was the same in both databases) but its parameters were not shown because their object_id only exist in master, right?
I think it's clear now, thanks.
|
|
Thu Jun 03, 2010 9:26 am |
|
 |
|
|
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
|
|
|