Sunday, February 12, 2012

API for Synonyms

Hi Experts:

I am writing a general API which would fetch synonyms from any database
providers (and would filter for a given schema).

I am using GetSchema method on DBConnection object and it works fine for
oracle.

SQL Server 2005 has a support for synonyms, but the above piece of code does
not work. Is there any API by which i can get the list?.

Thanks

AK

bets thing would be to use the SMO libraries, a sample script would be:

Code Snippet

foreach (Synonym s in s.Databases["Somedb"].Synonyms)

{

Console.WriteLine(s.Name);

}

Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment