Parse Field Descriptions of MS SQL Queries & Functions

Job ID: 30690468

Budget: $10 – $30 USD

Hi All
I Have many Views and UDFs in many databases
I need a .net function (vb.net or C#) that I can call on a View and get the descriptions that make up each field. For Example:
I have this Text:

CREATE VIEW MyView
AS
Select *, t.TimeZone+2 as MyTimeZone From(
SELECT States.*, Countries.name CountryName, States.Name + N' [' + Countries.Name + N']' AS FullName
FROM States
JOIN Countries ON States.CountryID = Countries.id
)t

Now I want to know what is the definition of each field, so your function should return the current list (just a list of keyvalue pairs is fine) :

FIELD DEFINITION
MyTimeZone= t.TimeZone+2
CountryName= Countries.name
FullName= States.Name + N' [' + Countries.Name + N']'

The reason I need this is, since the user sometimes sees a field MyTimeZone but has no idea why its showing a certain value, so this function will enable me to add a tooltip on the field that says "t.TimeZone+2".
same goes for many fields in all diferent views and udfs

I'd be happy to answer any questions

Here's another example:

CREATE VIEW MyView2 AS
SELECT Persons.*, Roles.Name RoleName, Domains.Name DomainName, Address Email, isnull((SELECT sum(amount) from viwtransactionpres where personid=persons.id),0) as Balance
FROM Persons
LEFT JOIN utl.Roles AS Roles On Persons.RoleID=Roles.ID
LEFT JOIN Domains on persons.DomainID=domains.id
LEFT JOIN (
SELECT * from(
SELECT personid,Address,row_number()over(partition by personid order by ordinal) as RowNum from emails )emls where RowNum=1 )t on t.PersonID =persons.id

Thanks!
Related categories: .NET SQL Microsoft SQL Server