Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
giteshshah
Starting Member
5 Posts |
Posted - 2014-01-27 : 20:08:14
|
HI Guys,I have a query (let's call it Query A) which takes approx 5-6 minutes to load the results.Query A is ran by more than 20 times a day.What I would like to do is to store the results of Query A in a separate table.I can perform some scheduled task every night which runs Query A and updates this new table.When a user wants to see the data they will be looking at the new table and not running Query A.Any ideas how to store the Query results into a new table.ThanksGitesh Shah |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-01-27 : 22:35:08
|
1. create the table with columns / data type etc to match the result of Query A. You only need to do this once2. delete QueryA_Resultexecute QueryA 3. Schedule query from (2) in SQL Server Agent KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-01-28 : 03:18:06
|
quote: Originally posted by giteshshah HI Guys,I have a query (let's call it Query A) which takes approx 5-6 minutes to load the results.Query A is ran by more than 20 times a day.What I would like to do is to store the results of Query A in a separate table.I can perform some scheduled task every night which runs Query A and updates this new table.When a user wants to see the data they will be looking at the new table and not running Query A.Any ideas how to store the Query results into a new table.ThanksGitesh Shah
Is it like table always need to have only latest queryA results?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
giteshshah
Starting Member
5 Posts |
Posted - 2014-01-28 : 06:26:25
|
Hi Guys,The results of QueryA doesn't need to be latest.It can have results from the schedule run of every night.Schedule query from (2) in SQL Server Agent - Can you please give me a reference link so I can schedule this queries?I will try creating this table and see if it works.Thanks for your help. Appreciated.CheersGitesh ShahGitesh Shah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-01-28 : 07:24:35
|
quote: Originally posted by giteshshah Hi Guys,The results of QueryA doesn't need to be latest.It can have results from the schedule run of every night.Schedule query from (2) in SQL Server Agent - Can you please give me a reference link so I can schedule this queries?I will try creating this table and see if it works.Thanks for your help. Appreciated.CheersGitesh ShahGitesh Shah
seehttp://databases.about.com/od/sqlserver/ss/sql_server_agent_3.htm------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|