SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Parameter popup for system stored procedures

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Parameter popup for system stored procedures
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Parameter popup for system stored procedures Reply with quote
Using
Code:
EXEC MASTER.sys.sp_addmessage

the popup offers the parameters.

Using simply
Code:
EXEC sys.sp_addmessage

it does not. Why? Should it not?
Wed Jun 02, 2010 3:46 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
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 View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
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 View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
For some reasons the metadata for certain system procedures is not visible in non-master databases. See for yourself

Code:
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.

Code:
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 View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.