Please refer to: http://msdn.microsoft.com/en-us/library/aa175782(v=sql.80).aspx
--Function that encapsulates xp's and OPENXML
--creation of function udf_xml succeeds
Create function udf_xml(@XMLDoc varchar(8000))
Returns @t table(ProductID int, Quantity int)
as
begin
declare @iDoc int
Exec sp_xml_preparedocument @iDoc OUTPUT, @XMLDoc
INSERT @t
SELECT * FROM OPENXML(@idoc, '/ROOT/Order',0)
WITH (ProductID int, Quantity int)
Exec sp_xml_removedocument @iDoc
return
end
GO
Thanks,
Sanjay
Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator