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
 SQL Export to EXcel

Author  Topic 

Julie19
Starting Member

32 Posts

Posted - 2012-05-22 : 13:52:56
Hello,

I have exported data from SQL to excel using the import/Export wizard
Issue is the data gets updated daily in SQL and when imported to excel it is appending the data.When the data is appending th data is added at the last row
My users need to see this data daily and also compare the old data.
Is there any code that is needed when the data loads into Excel SQL
I need somethinglike this on my excel
First name last name 5/24 5/25 5/26

This is my code in SQL which has the reports for daily

SELECT ReportDate, RptFunction,Agent, Daily1Day, [1DayDailyAttain],
(SELECT [X]
FROM dbo.t_Month) AS OnedayRes,
(SELECT Y FROM dbo.t_Month ) AS DailyDate,
(SELECT Z FROM dbo.t_Month
WHERE (ReportDate = '2012-05-22')) AS RptDate
FROM dbo.q_Agent
WHERE (INT_EXT = 'i') AND (ReportDate = '2012-05-22')

What is the best way to do this so my users can see the data everyday?

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2012-05-22 : 17:07:03
You can use SSIS package to import the data from SQL to EXCEL file
and while transformation you can use derived component between source and destination which will derived the new column and will placed the current date. Try using SSIS package for your requirement .

Vijay is here to learn something from you guys.
Go to Top of Page
   

- Advertisement -