Solved

asp.net sql

Posted on 2014-10-07
5
119 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

832 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