how to use a SQL view as a data source for Excel file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cckelly
    New Member
    • Apr 2007
    • 3

    how to use a SQL view as a data source for Excel file

    Hello, all!
    I need help. There is a "view" in a SQL Server 7 database that contains all the data I need.

    I want to create an Excel file (version Excel 2000). I want the file to open the view and refresh the data every time. (The view pulls records for the past 3 months.)

    I've tried the Excel menu option "Data | Get External Data | New Database Query" to select the view from the list of database objects. A message appears and the Excel spreadsheet is populated with records. I then saved the .xls file.

    PROBLEM: The data isn't refreshed everytime I open the .xls file. It still contains "old" data.

    What do I need to do to let Excel know to re-pull the view/query every time the .xls file is opened? (The versions of SQL Server and Excel are "old", but I can't do anything about that at this time.)

    Any ideas? (Think of simple things--I have a new computer and the IT dept. may not have installed all the add-ins, etc. that I need for this task.)
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    I am not an Excel specialist you probably need to refer your question to another forum like Access.

    To pool data for last 3 months you need to use where condition like this:

    Code:
    Where date_column between dateadd(m, -3, getdate()) and getdate()
    Good Luck.

    Comment

    • cckelly
      New Member
      • Apr 2007
      • 3

      #3
      Thanks for the reply!

      I created the existing "view" on the SQL Server database with a date function similar to your example. This "view" is being used for several different purposes. I want to use Excel because of it's cool functions, graph capabilities, and easy-to-use filters and such.

      I'll post this request on the Access forum as you suggested...

      Comment

      Working...