开发者

Passing XML to Procedures

开发者 https://www.devze.com 2023-01-12 04:50 出处:网络
I just switched groups and what they currently do is have their middle tier pass XML to the procedures and then use xquery/xpath to parse the xml and use it to get information and return it back to th

I just switched groups and what they currently do is have their middle tier pass XML to the procedures and then use xquery/xpath to parse the xml and use it to get information and return it back to the app (RETURN XML). I was just curious if others use a similar process or if they just pass the data directly into the procedures. I开发者_运维知识库 really like how flexible it is, but it really makes the procedures ugly because you have to parse the XML, query your data, and format the data into xml (formatting is trivial with SQL 2008).

My main concern is with performance. I have to parse the xml and put it into tmp tables or table variables so that I can use it in my queries.

Any thoughts?


I have had similar approach, only for webservices, not stored procedures. I would say, that it's not a good practice and should be avoided unless absolutely needed.

Main problem probably isn't performance, but fact, that you are creating GIGO (garbage-in-garbage-out) component, where you don't have any formal contract between caller and procedure. Which means that wrong data on input/output can go unnoticed and you will have hell of a debugging.

And yes, you will get some performance hit too (probably on both layers).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号