我有2 sprocs的任務,我想要做的是將xml輸出從一個sproc傳遞到另一個,並將其放入一個變量,我知道ex1.xml_sp1返回一個int,同時調用它與EXEC
,顯然當試圖選擇它時它返回null,因爲@x
是xml數據類型。如何將xml數據從一個sproc傳遞到另一個sproc?
我想要做的是檢索和存儲過程從1 XML數據存儲在@x
存儲過程2.
有沒有辦法做到這一點?
存儲過程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')
存儲過程2:
ALTER PROC [ex1].[xml_sp2]
@careteamid int
as
declare @x xml
exec @x = ex1.xml_sp1
@careteamid = @careteamid
select @x as XMLData
正是我以後,謝謝百萬 – BoogaWooga