Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

is it possible to save data in excel by user id Expand / Collapse
Author
Message
Posted Thursday, May 1, 2014 4:03 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 2, 2014 10:20 AM
Points: 19, Visits: 121
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

....
Post #1566866
Posted Friday, May 2, 2014 5:01 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 3:13 PM
Points: 6,842, Visits: 13,364
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.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1566987
Posted Friday, May 2, 2014 8:09 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 2, 2014 10:20 AM
Points: 19, Visits: 121
"save by userId" mean file name for excel and email the file to same userid email in the file.

Thanks for your response.
Post #1567042
Posted Friday, May 2, 2014 8:17 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 3:13 PM
Points: 6,842, Visits: 13,364
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.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1567051
Posted Friday, May 2, 2014 8:25 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 2, 2014 10:20 AM
Points: 19, Visits: 121
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
Post #1567055
Posted Friday, May 2, 2014 8:46 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 3:13 PM
Points: 6,842, Visits: 13,364
See Phil Factor's article for detailed examples of different ways to export to Excel.



Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1567068
Posted Friday, May 2, 2014 11:02 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 5:53 PM
Points: 143, Visits: 316
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.
Post #1567125
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse