I recommend that you download XLeratorDB and try this problem along with me, this is going to be a fun exercise and something new to learn about Business Days.
Imagine this. Your users have developed an Excel spreadsheet that extracts data from your SQL Server database, manipulates that data through the use of Excel formulas and, possibly, some VBA code which is then used to calculate P&L, hedging requirements or even risk numbers. Management comes to you and tells you that they need to get rid of the spreadsheet and that the results of the spreadsheet calculations need to be persisted on the database.
Learning any technology is easy when we have good documentation and sample database to play along with. When I have to learn any new technology, my first action is to install the trial software and look for sample database next. Once I get sample database, I try to find a video tutorial about the technology and continue to learn onwards. Let’s see PowerPivot for Excel 2010 and PowerPivot in Excel 2013 Samples here.
Earlier I wrote two articles about how to efficiently copy data from SSMS to Excel. Since I wrote that post there are plenty of interest generated on this subject. There are a few questions I keep on getting over this subject. One of the question is how to get the leading zero preserved while copying the data from SSMS to Excel. Well it is almost the same way as my earlier post SQL SERVER – Excel Losing Decimal Values When Value Pasted from SSMS ResultSet. The key here is in EXCEL and not in SQL Server.
SQL Server Management Studio returns results in Grid View, Text View and to the file. When we copy results from the Grid View to Excel there is a common complaint that the column header displayed in resultset is not copied to the Excel. I often spend time in performance tuning databases and I run many DMV’s in SSMS to get a quick view of the server. In my case it is almost certain that I need all the time copy column headers when I copy my data to excel or any other place.
I often get questions that how to fix the issue where excel loses decimal values when values are pasted from SSMS Resultset.