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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Direction for project

Author  Topic 

chapm4
Yak Posting Veteran

58 Posts

Posted - 2012-03-26 : 17:12:07
Have following statement that comes from a view on corporate database through linked server on local database.

SELECT eveID, sitID, EventDate, inrCode FROM OPENQUERY(corporateServer, 'select * from  corpServer.corpDB.dbo.vw_HealthAndSafetyEventList') AS HSEL WHERE (siteID = 11) ORDER BY EventDate DESC, safetyCode


Need to pull certain safetyCodes, subtract EventDate from todaysDate, count certain records, etc.

Should I throw this into a table or view on the local database? Should I run it as a stored procedure on a daily schedule?

The data will be used on an intranet site ASP page and I think I want to do most of the calculations on the sql side and not directly on the ASP page.

Problem is I am a newbie and need direction. Thanks for the help.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-27 : 12:09:07
best thing is to dump these onto a table and use table for all other calculations. Thats much better than calling linked query multiple times and using it directly in too many joins

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -