i have the following table data in ms sql server table name category

and the problem is that i want to get the data of grand parent,parent,siblings,child and sub child and self.
i hope you get my point , if need any more clarification from my requirement i can edit my question just put a comment below.
as far about my try i searched stackoverflow and i found a lot of examples of getting full hierarchical data using parent but don’t find anything which is related to pass the child and get parent, sub child and self.
I am also open for the solution which provide me solution using linq because then i can take complete data in Category and can use linq their on .cs page.
Edit :
if i pass the 7 which is heritage CategoryId then the query should returns the following rows

The answer is to use a recusive “Common Table Expression”, or CTE. This allows you to build the structure of your hierarchy. Below is an example, modified to match your structure, based on this page: http://msdn.microsoft.com/en-us/library/ms186243.aspx
Updated to reflect your updated question.
edit I know you were able to get the above basically working for you with the added distinct, but I thought of a better way to handle this after I left chat: