Q:

Passing a value from a select statement into a function inside the same query - SQL , SSRS

I have a SQL query like this for me to use in the SSRS . 
Select Id ,
       Name ,
       (SELECT RecordNumber FROM dbo.GetLinkedRecordsByType(DTI.TYPEID, DT.ProjectID) AS          
         doctype WHERE      (Id = DTI.SourceId)) AS LinkedDocNo,
       etc,etc .. From Table_name .

Now I have condition that I need to pass the value of LinkedDocNo  into another function in the same query as a subquery . something like this 
dbo.WBS_GetNodePath(LinkedDocNo) . 

But I know I cant pass it like i have done above. Kindly suggest me a way to achieve it .

A:

Ok, why dont you try the following: 
- it is valid only if your function is table-valued 
,select 'column_name' from dbo.WBS_GetNodePath((SELECT RecordNumber FROM  dbo.GetLinkedRecordsByType(DTI.TYPEID, DT.ProjectID) AS          
     doctype WHERE (Id = DTI.SourceId))) 

Or try exactly the same without:
--'column_name' from

    ,select dbo.WBS_GetNodePath((SELECT RecordNumber FROM  dbo.GetLinkedRecordsByType(DTI.TYPEID, DT.ProjectID) AS          
     doctype WHERE (Id = DTI.SourceId))) 

