1

After searching I did not find answer to my question. If I have linked table in Microsoft Access I have table updates every time if data changed.

I am now using SQL server and I have a stored procedure collecting data from many tables. I want this procedure to be executed once and the results to be stored in a table, or update if the data has changed.

How can I achieve this in SQL Server?

Thom A
  • 88,727
  • 11
  • 45
  • 75
  • 1
    You could do that by using triggers, but simple problems can become difficult if you try to do it using triggers. Why do you need to update the data all the time, instead of just fetching it from the original tables when you need it? – James Z Apr 08 '18 at 12:43
  • Perhaps [Linked Servers](https://learn.microsoft.com/en-us/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine) is what you look for? After that you can select from any database on that server by adding the Linked Server name and database name. – LukStorms Apr 08 '18 at 12:49
  • the data is increasing Significantly and this data been analysed by Qlik Sense software so i need every time the updated data.@JamesZ – Yaman Alsaadi jbawi Apr 08 '18 at 12:51
  • @LukStorms i have read article related Linked Server but even i use it i need to call that stored procedure every time to have the updated data. – Yaman Alsaadi jbawi Apr 08 '18 at 12:54
  • Note that if a database in on the same server as what you're connected on, then you can just query it by adding the database name. `select * from [otherdatabasename].[schema].[sometable]`. Maybe your question is about the stored procedure then. Does this [similar question](https://stackoverflow.com/questions/8207559/how-to-execute-store-procedure-for-another-db) answer it? – LukStorms Apr 08 '18 at 12:59
  • @LukStorms i agree with you but i have data coming from many tables by calling store procedure i want to be executed one time and have always the updated data. – Yaman Alsaadi jbawi Apr 08 '18 at 13:06
  • Then I'm out. I'm thinking about [Replication](https://msdn.microsoft.com/en-us/library/ms151198(v=sql.120).aspx). Or maybe using [Merge statements](https://learn.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql) in the procedure. But my hands-on experience is too lacking in those aspects to come up with a good answer. – LukStorms Apr 08 '18 at 13:25

0 Answers0