May 1, 2014 at 4:03 pm
is it possible to save data in excel by userID and also need to email the file too
Here is the sample data
User ID | Email | Product Info | Price
---------------------------------------
23456 | a@hotmail.com | ABC | 23.00
23456 | a@hotmail.com | ABC | 23.00
23456 | a@hotmail.com | ABC | 23.00
12345 | d@hotmail.com | ABC | 23.00
12345 | d@hotmail.com | ABC | 23.00
....
May 2, 2014 at 5:01 am
This is more than a vague question...
What do you mean "save by userId"? Just the sort order within a Excel worksheet? An additional line between each userId to separate it visually?
Separate Worksheets? Separate Excel files?
What do you mean by "email the file too"? Do you want to mail the final Excel file just created or the output of the query as csv or xls file?
In all cases the short answer is "Yes, it can be done". But the effort may vary...
If you need a moer detailed answer, please provide a more detailed question together with ready to use sample data and expected result(s). See the first link in my signatur on how to do that to make it easy for us to help you.
May 2, 2014 at 8:09 am
"save by userId" mean file name for excel and email the file to same userid email in the file.
Thanks for your response.
May 2, 2014 at 8:17 am
Do you need to physically save the file or just to mail it?
If the latter, have a look at sp_send_dbmail.
You'll need to loop through the userID's and send the mail based on filtered data.
May 2, 2014 at 8:25 am
Do you need to physically save the file or just to mail it? >>>>>>>>>> Yes I need both physically save the file and also send mail
May 2, 2014 at 11:02 am
Yes using SSIS you can do this.
Good Luck 🙂 .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply