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 |  
                                    | credStarting Member
 
 
                                        2 Posts | 
                                            
                                            |  Posted - 2009-07-20 : 09:18:39 
 |  
                                            | Hi, first post here... give me some space and let me know if you need more info!Basically I am pretty inexperienced in SQL and need some help with code and possibly logistically of what I am hoping to do.At the moment I have some tables and have written a query which is run each day to output for each email address, a time variable and two counting fields. The emails only get selected if the counts are over a certain value inside a certain timeframe. This is outputting into a pivot table at the moment so that the time can be varied and the counts.What I would like to do is be able to automate to certain degree... So...1. Run the query possibly from excel or a VB window2. Print the emails onto the pivot table as already done3. On another excel sheet have a list of emails meeting the criteria of, for example Count1>2 and Count2>2. So have a list of all emails, historic and new.4. Generate an excel list of only the NEW emails added to the list in 3. on that day.Am I thinking of this in the correct way or should I try and do less/more with Macros and Excel.Any help would be appreciated!!Thanks |  |  
                                    | credStarting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2009-07-20 : 09:42:30 
 |  
                                          | Perhaps this should be in a different area... sorry if this is the case.FYI I am using SQL Server 2005 |  
                                          |  |  |  
                                    | cat_jesusAged Yak Warrior
 
 
                                    547 Posts | 
                                        
                                          |  Posted - 2009-08-07 : 17:56:05 
 |  
                                          | You can use "import external data" in the data menu to connect to a SQL server database. If you connect to a view the "query" can be the view definition(as long as you don't need to change the selection criteria). Then use macros to move the data to a new sheet.You can do this in VBA too, but I've only done that with Access.An infinite universe is the ultimate cartesian product. |  
                                          |  |  |  
                                |  |  |  |