I have 2 sprocs for an assignment, what I'm trying to do is pass the xml output from one sproc to another and put it in a variable, I know ex1.xml\_sp1 is returning an int while calling it with `EXEC` and obviously when trying to select this it returns null because `@x` is xml data type.

What I want to do is retrieve and store the xml data from sproc 1 in to `@x` in sproc 2.

Is there any way to do this?

sproc 1: 

```
ALTER PROC [ex1].[xml_sp1]
@careteamid int
as

select CareTeams.CareTeamID, Doctors.DoctorID, Doctors.DoctorName,
   CareTeamDoctors.DateJoined, CareTeamDoctors.CurrentMember
from dbo.CareTeamTbl as CareTeams
inner join dbo.CareTeamDoctorTbl as CareTeamDoctors on
CareTeams.CareTeamID = CareTeamDoctors.CareTeamID
inner join dbo.DoctorTbl as Doctors on
CareTeamDoctors.DoctorID=CareTeamDoctors.DoctorID
where CareTeamDoctors.CareTeamID = @careteamid
and CareTeamDoctors.DoctorID = Doctors.DoctorID
for xml auto, root('thedata')

```

sproc 2:

```
ALTER PROC [ex1].[xml_sp2]
@careteamid int
as 
declare @x xml

exec @x = ex1.xml_sp1
          @careteamid = @careteamid

select @x as XMLData

```