TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sonali Avhad
NA
234
42.8k
send email with excel attachment using sql stored procedure
Feb 1 2021 6:04 AM
I using sql stored procedure for sending email with attachment.
I want to send email with excel attachment.
I used the following code
DECLARE
@Body
VARCHAR
(8000)
DECLARE
@Qry
varchar
(8000)
SET
@Body =
'Hi PFA,'
SET
@Qry=
'set nocount on;select * from tblname'
DECLARE
@tab
char
(1) =
CHAR
(9)
EXEC
msdb.dbo.sp_send_dbmail
@profile_name =
'Profilename'
,
@recipients =
'receipentemail'
,
@body= @Body,
@query=@Qry,
@subject=
'Send db mailer with attachment'
,
@attach_query_result_as_file = 1,
@query_attachment_filename=
'Report.xls'
but in excel is not proper it is disturbed columns and rows.
Please help me for proper excel attachment.
Reply
Answers (
1
)
Multiple if else in linq select property
develop desk top software on C# .net for sending sms