Guest User

Untitled

a guest
May 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. [SqlFunction(
  2. DataAccess = DataAccessKind.Read,
  3. FillRowMethodName = "List_FillRow",
  4. TableDefinition = "Date datetime, Quantity int")]
  5. public static IEnumerable ListCount(...)
  6. {
  7. using (SqlConnection con = new SqlConnection(connectionStringToSERVER2))
  8. { ... }
  9. return list;
  10. }
  11.  
  12. CREATE PROCEDURE [dbo].[sp_Reports_NumaraSpalariJetWash]
  13. BEGIN
  14. DECLARE curs CURSOR
  15. LOCAL STATIC READ_ONLY FORWARD_ONLY
  16. FOR
  17.  
  18. SELECT ...
  19.  
  20. OPEN curs
  21.  
  22. FETCH NEXT FROM curs
  23. INTO ...;
  24.  
  25. WHILE @@FETCH_STATUS = 0
  26. BEGIN
  27.  
  28. INSERT INTO ...
  29. (...)
  30. SELECT Date, Quantity
  31. FROM dbo.ListCount(...)
  32.  
  33. FETCH NEXT FROM curs
  34. INTO ...;
  35. END
  36. END
Add Comment
Please, Sign In to add comment