title: How to create a custom materialized view that pulls up data from one server to another in SQL Server?
body: <p>I have 2 databases, the first one called "db1" and the second one called "db2". each one is located on a different server: "server1" and "server2" respectively. However, those 2 servers are connected which means I can query "db2" from "server1".</p>
  
  <p>I have a complicated stored procedures located in "db1" that queries "db2". This stored procedure is complicated and has lots of joins and unions. I was thinking if I can create a materialized view inside "db1" that execute this complicated stored procedure every day at 12:00 AM. so I can query the view directly from "db1" located on "server1" without connecting to "db2" located on "server2".</p>
  
  <p>Again, "server1" and "server2" are linked servers.</p>
  
  <p>Can anyone show me how to create this materialized view?</p>
  
  <p>Thanks!</p>