Wednesday, April 24, 2013

How to send Email from SQL Server with attached csv file

Please see the below sample code which will send email which will have an csv attachement.

Exec [msdb].[dbo].[sp_send_dbmail] 
@profile_name = '',
@recipients = 'emailid',
@body = ' Hello Sir,Please find the attached details...',
@body_format ='HTML',
@subject = 'Subject',
   @attach_query_result_as_file = 1, 
   @query_result_header = 1,
   @query_result_no_padding = 1,
   @query = 'SET NOCOUNT ON; SELECT EmployeeName, Address FROM  EmployeeDetails',
   @query_result_separator = ' ',
   @exclude_query_output = 1,
   @query_attachment_filename = 'EmployeeDetails.csv'


Anonymous said...

The varieties accessible at Toms shoes appear in altered and actual alien colors, shapes and fabrics. The basal appearance of shoes is alpargata, mostly begin in Argentina. But TOMS took the Alpargata to the next level. The best affair about TOMS is that if you boutique from them, you not alone get a shoe of your best but you accord in an actual blue-blooded amusing could cause which makes you feel good. The shoes are calamus weight and actual accidental in looks. The central exceptional superior covering and alfresco elastic sole makes the shoes actual adequate and aswell keeps them warm. They are absolute for an accepted circadian base use. Their a lot of accepted appearance is Cordones which are best for jailbait women. It's the American acclaimed cast which is originally advised for poor children.NO! TOMS is now also selling clothing & accessories. All purchases of TOMS Clothing and TOMS accessories also support the One for One mission.[url=]Cheap Toms[/url] All Where Do They Sell Toms shoes are slip-ons. They usually can be found in a variety of colours, types, fabrics and designs. Readily available in burlap, corduroy and canvas, these sneakers have got a skinny sole and are functional, classy in addition as resilient. They do not have that cumbersome seem like that of sneakers. So, they glimpse terrific when worn with capris, shorts or pants. This variety of footwear would make for your great day-to-day shoe. You'd probably not have any type of issue associated with structural harm or tearing with footwear from Where Do They Sell Toms. The fabric certainly is apparently extremely durable. The leather insoles are also really relaxed and supportive. Purchasers are always advised to buy a pair of Where Do They Sell Toms footwear that match somewhat tight mainly because canvas frequently stretches. This footwear will fit tight for any week or so but they will just be appropriate after a week of have on. Later on the shoe will fit like a glove as well as wearer can have no difficulty with blisters or rubbing.How much does shipping and handling cost? Shipping cost is automatically calculated at checkout and will vary depending on the number of items purchased, where your order is being shipped and the type of shipping chosen. Please review the order total before confirming your purchase. [url=]Toms Shoes[/url] Is TOMS Shoes Just Shoes? Toms for a Better Tomorrow and a Brighter Future [url=]Cheap Toms Sale[/url] You can purchase TOMS for ones Prom parties when they have a selection of glittering; bling shoes which are sure to draw eyeballs towards you and of course these shoes! Or if you need to stand out how the whole crowd you'll be able to want to wear the Artist range. These are flats which are painted by hand and each one is unique of additional. You may want to try the Navy embroidered shoes for ones kids or shoes in colourful checks for tiny tots. They usually have gorgeous wedding shoes line too. If you're one of those who desire to shake a leg and stay really comfortable inside flowing wedding gown, you'll be able to pick the glitters choice of shoes at TOMS! The peculiar name of the shoe: Toms is not based on a person called Tom but on the popular usage of tomorrow as tom. It is based on the concept Shoes for tomorrow project.
Relate Post

Anonymous said...

magnificent points altogether, you just received a new reader.

What might you recommend in regards to your post that you simply made
a few days ago? Any positive?

Feel free to surf to my website ::

Anonymous said...

After I initially left a comment I appear to have clicked
on the -Notify me when new comments are added- checkbox
and from now on each time a comment is added I get 4 emails with the same comment.
Perhaps there is an easy method you can remove me from that service?
Appreciate it!

Here is my weblog :: bmi chart for women

Anonymous said...

It's very easy to find out any topic on web as compared to books, as I found this piece of writing at this web page.

My web site Simply click now to undo-options a free account together with InstaForex

Anonymous said...

I was confronted with the same problem and received the original motorists to put in by operating the
installer in vista compatibility method and disable finalizing.

My web-site; xerox phaser 8560 service manual

Anonymous said...

Good day! I simply want to give you a big thumbs up
for your great information you have here on this
post. I will be returning to your blog for more soon.

Also visit my weblog; best family attorney

landscape paintings nature art landscape art sky art illustration art artwork art human art beautiful art landscape prints nature prints sky prints illustration prints artwork prints human prints beautiful prints beautiful special promotions nature special promotions sky special promotions illustration special promotions artwork special promotions beautiful canvas prints beautiful painting canvas prints beautiful framed prints beautiful painting framed prints beautiful posters beautiful painting posters