Email Notification using SQL Server database jobs

Source: Internet
Author: User
Effect: send emails regularly to remind them that they have not logged on for X days. (X is defined by myself) implementation principle: the data used by SQL Server jobs, database emails, and stored procedures is used: the user table is used, and the table name is tb_Admin. The following shows the main fields to be used: field name interpretation Id Primary Key RealNa

Effect: send emails regularly to remind them that they have not logged on for X days. (X is defined by myself) implementation principle: the data used by SQL Server jobs, database emails, and stored procedures is used: the user table is used, and the table name is tb_Admin. The following shows the main fields to be used: field name interpretation Id Primary Key RealNa

Effect:

Send emails regularly to remind them that they have not logged on for X days. (X is defined by yourself)

Implementation principle:

SQL Server's "job", Hong Kong space, "database mail", and "Stored Procedure" are used"

Data used:

The User table named tb_Admin is used. The following shows the main fields to be used:

Field name

Explanation

Id

Primary Key

RealName

Real User Name

LoginTime

Display the logon time of a user

UserEmail

User email

Implementation of stored procedures:

I recently studied sqlserver and rented a Hong Kong server. It may not be very good. However, the final effect can be achieved. If you have any better ideas, you may wish to leave me a message or use a VM to learn more.

Stored Procedure: You can transmit the relevant parameters to output the mailbox for obtaining data and the real User Name:

The Code is as follows:

., (20) outputUserEmail, ROW_NUMBER () (DD, LoginTime,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.