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
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 SQL and Excel

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2014-03-05 : 12:12:29
Hi -

My company has a standard way of gathering information (from the sales department) and getting it to the actuarial department for use in retrieving data. Most of this is done using excel because just about everyone uses excel! They would send that to the actuarial department (me) and I would use the information to update some sql code to run and retrieve the data needed. Now, I would like to do it in one shot.....I have made an excel book that after the user inputs key information into an input sheet, the code automatically updates. Next, I want to write a macro that copies the code, starts sql, pastes it to sql, runs it then pastes the results back into sql. I can't get it to work though.

Can anyone please help with this?

Thank you in advance!!

John

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-03-05 : 15:41:57
quote:
Originally posted by jcb267

Hi -

My company has a standard way of gathering information (from the sales department) and getting it to the actuarial department for use in retrieving data. Most of this is done using excel because just about everyone uses excel! They would send that to the actuarial department (me) and I would use the information to update some sql code to run and retrieve the data needed. Now, I would like to do it in one shot.....I have made an excel book that after the user inputs key information into an input sheet, the code automatically updates. Next, I want to write a macro that copies the code, starts sql, pastes it to sql, runs it then pastes the results back into sql. I can't get it to work though.

Can anyone please help with this?

Thank you in advance!!

John

Depending on the details of what you are trying to accomplish, I would go one of two ways:

1. Write Excel macros to access the SQL Server database, query or save data as required.

or

2. Use an SSIS package to send data to the SQL Server (or populate the data from SQL Server).

If you choose the first route, and from what little I know that seems like what you may need to use, look up some tutorials on how to interact with SQL Server from Excel. Here is an example: http://www.mdobie.co.uk/2012/11/14/query-ms-sql-server-with-excel-vba/
Go to Top of Page

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2014-03-06 : 12:12:59
Thank you, James!
Go to Top of Page
   

- Advertisement -