Advertisement
Guest User

Untitled

a guest
Apr 28th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. DECLARE @products table (prdid varchar(40));
  2. Insert INTO @products values('A111'),('B111'),('A123'), ('Z456');
  3.  
  4. with rec_query as (
  5. ---anchor member
  6. '
  7. '
  8. where pid IN @products
  9. UNION ALL
  10. ---recursive members
  11. '
  12. '
  13. )
  14.  
  15. select prdid, rec_query.*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement