Advertisement
yambroskin

Untitled

Jun 6th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <procedure name="AddKonturAnalitics">
  2. <mappings>
  3. <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  4. <sql-query name="ExecAddKonturAnalitics">
  5. exec AddKonturAnalitics @xml=:xml, @analiticsUid=:analiticsUid
  6. </sql-query>
  7. </hibernate-mapping>
  8. </mappings>
  9. <text>
  10. <![CDATA[
  11. create procedure [dbo].[AddKonturAnalitics] (@xml varchar(max), @analiticsUid uniqueidentifier)
  12. as
  13. BEGIN
  14. DECLARE @handle INT
  15. DECLARE @PrepareXmlStatus INT
  16. DECLARE @inn varchar(250)
  17. DECLARE @ogrn varchar(250)
  18. DECLARE @focusHref varchar(max)
  19. DECLARE @q1001 bigint
  20. EXEC @PrepareXmlStatus= sp_xml_preparedocument @handle OUTPUT, @XML
  21. DECLARE MY_CURSOR CURSOR
  22. LOCAL STATIC READ_ONLY FORWARD_ONLY
  23. FOR
  24. SELECT
  25. inn as INN,
  26. ogrn as OGRN,
  27. focusHref As FocusHref,
  28. q1001 as Q1001
  29. FROM OPENXML(@handle, '/ArrayOfanalytics/analytics/analytics', 2)
  30. WITH (
  31. inn varchar(250) '../inn',
  32. ogrn varchar(250) '../ogrn',
  33. focusHref varchar(max) '../focusHref',
  34. q1001 bigint)
  35. OPEN MY_CURSOR
  36. FETCH NEXT FROM MY_CURSOR INTO @inn, @ogrn, @focusHref, @q1001
  37. WHILE @@FETCH_STATUS = 0
  38. BEGIN
  39. exec [CreateAnaliticsRequest] @inn, @ogrn, @focusHref, @q1001
  40. FETCH NEXT FROM MY_CURSOR INTO @inn, @ogrn, @focusHref, @q1001
  41. END
  42. CLOSE MY_CURSOR
  43. DEALLOCATE MY_CURSOR
  44. EXEC sp_xml_removedocument @handle
  45. END
  46. ]]>
  47. </text>
  48. </procedure>
  49.  
  50.  
  51. ------
  52.  
  53. <ArrayOfanalytics xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  54. <analytics>
  55. <inn>9901000362</inn>
  56. <ogrn>1029900507372</ogrn>
  57. <focusHref>https://focus.kontur.ru/entity?query=1029900507372</focusHref>
  58. <analytics>
  59. <q1001>42</q1001>
  60. </analytics>
  61. </analytics>
  62. </ArrayOfanalytics>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement