question

user-1259 (google) avatar image
user-1259 (google) asked

system table for Synonyms?

Hello,

Is there a system table I can query that shows the Synonyms I've created?

-James

sql-server-2005system-views
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image
Matt Whitfield answered

That would be

SELECT * FROM [sys].[synonyms]
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Wimbush avatar image David Wimbush commented ·
+1. Very dry. I like it!
0 Likes 0 ·
Ian Roke avatar image Ian Roke commented ·
+1 Or that. I always prefer to just use the base table and not views of that data so I don't have to look at multiple pages to find what I need from MSDN. All I need to look at is the sys.objects reference page. Congrats on getting to 7k points! :-)
0 Likes 0 ·
Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
Sys.objects is good until you need to know anything specific - for example the base onject name on a synonym, the referenced object for a foreign key etc... it's a similar situation with sys.columns and sys.identity_columns and sys.computed_columns
0 Likes 0 ·
Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
P.s. thanks! :)
0 Likes 0 ·
Ian Roke avatar image Ian Roke commented ·
That's interesting. I've never thought about that before. Thanks for the tip. :-)
0 Likes 0 ·
Ian Roke avatar image
Ian Roke answered
SELECT * FROM sys.objects
WHERE type = 'SN'

More information available here.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.