Hi guys,
I am writing some sort of tool and I need to get the table a column belongs to.Before you ask for certain reasons too long to explain I need to get it from the column.
I have found out that the following will give me the answer however before I start splitting the string which it could be messy.
is there another way to do it?
My way so far:
?col.Urn.Value Gives:
"Server[@.Name='MYServer']/Database[@.Name='MyDB]/Table[@.Name='UserTable' and @.Schema='dbo']/Column[@.Name='Surname']"
So now .How can I split it to get the table Name? or better is there a cleaner way to do it?
Thanks again for your time in advance
col.Parent will return you a SqlSmoObject which you can cast as a Table (or View).
Hope that helps.
Thanks,
Kuntal
No comments:
Post a Comment