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 2005 Forums
 Transact-SQL (2005)
 Sql Report

Author  Topic 

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2009-10-30 : 00:37:07
Hi All,
my req was,export some resultset to Excel from Db(Sql server 2005) and then the excel sheet has to be mailed to particular people and this also has to be done by automatic on the daily basis of particular time.

time being iam doing manually like copying the data from Db and pasted it in a excel sheet and then sending the attachment using outlook as a daily activity of 8 pm(IST).

now this process has to be achived in the automatic way using sql scheduler or anyother best way.iam new to sql report/scheduler.

so pl advice me on this regrad.

any help would be appreaciated

asgast
Posting Yak Master

149 Posts

Posted - 2009-10-30 : 04:57:50
1) look on google how t export to excel from sql :) remember that microsoft was to lazy to provide a driver for 64 bit version :(
2) write a store procedure that collects data and writes to excel file and sends mail automatically
3) schedule the procedure

it's rather difficult to give a ready solution for you
I have an empty excel file on the disk set up as a linked server, I have a procedure that drops data into it, then i send this file using mailsend, and copy a template empty file over the one with data, to keep it empty for the next run.

you can use bcp if you don't exactly need the excel format.

Can't fall asleep, the ghost of sql server will get me for writing bad queries. Have to stay awake ...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-30 : 09:10:09
Make sure of this
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

and schedule it as job

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -