I have a table as shown below :
                     TBLContact
-------------------------------------------------
BranchId  DepartmentId  DepartmentName   Phone No
-------------------------------------------------
 BID100    DTID001       Mechanical       123654
 BID100    DTID001       Mechanical       887744
 BID101    DTID002       Automobile       045167
 BID101    DTID002       Automobile       674632
I have to structure a query in a stored procedure in a way such that, on passsing 'BranchId' as a parameter to the query it would return the Department Phone No's of the corresponding 'BranchId' in a single row separated by a comma, although the 'Phone No' exists in two rows for a specific 'BranchId'. For Example; Consider passing the value 'BID100' as a parameter to the query/stored procedure, the query would return me a result as below:
BranchId DepartmentId  DepartmentName   PhoneNo
---------------------------------------------------
 BID100    DT001        Mechanical    123654,887744
PS: I am using SQL Server 2008.
 
     
    