Solved

asp.net sql

Posted on 2014-10-07
5
112 Views
Last Modified: 2014-10-10
Assume I have a query like select firstname, email from person. and the list I want to wrap into html and email to someone else. And I want to send it at 11:00 pm daily. In the condition, what is the best method I can use?

My database is SQL Server 2012 and I do have IIS.

I know asp.net/c# languages, and of course I can write Stored Procedures.
0
Comment
Question by:ITsolutionWizard
  • 2
  • 2
5 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40367393
Huh?   Please provide more details as to what you are asking here.

>Assume I have a query like select firstname, email from person.
Okay, either use a SQL Server view or a stored procedure.

>the list I want to wrap into html and email to someone else.
Not sure about ASP.NET.  Do you mean send an email where the body is the html, or send an email with an attached file that has the html?

>And I want to send it at 11:00 pm daily
Either an SSIS package to output the file, and a SQL Agent job to schedule it.
A better idea would be an SSRS report with a data-driven subscription.
0
 

Author Comment

by:ITsolutionWizard
ID: 40367442
Not sure about ASP.NET.  Do you mean send an email where the body is the html, or send an email with an attached file that has the html?  Yes.
0
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
ID: 40367505
You can create a SP which can generate the html body and send an email with that html body.
Create a SQL agent job to run the sproc at specific time.
0
 

Author Comment

by:ITsolutionWizard
ID: 40367559
Got it. But the Email (TO) is based on the result from the query. For example, I may want to send 4 contacts emails from the query1 or 3 contacts from query2.

How can I do it in SQL Agent?
0
 
LVL 40

Expert Comment

by:Sharath
ID: 40372435
Are you still looking for a suggestion?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now