Home > Ask the SQL Server Experts > Archive: Reporting Services Questions & Answers > SQL Server trigger vs. stored procedure to receive data notification
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

SQL Server trigger vs. stored procedure to receive data notification

Roman Rehak EXPERT RESPONSE FROM: Roman Rehak

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Expert advice on database administration
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 06 October 2008
I am using SQL Server 2000, and I have a database field for warranty expiration dates. I would like to know 30 days in advance when an item is about to go out of warranty. How would I go about creating a trigger to inform me of this?


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
SQL/Transact SQL (T-SQL)
Using DELETE and TRUNCATE TABLE statements to delete data in SQL Server
SQL language crash course (just enough to be dangerous)
Working with IntelliSense in SQL Server 2008 Management Studio
SQL Server Mailbag: Stored procedures, triggers and SSRS reports
Working with sparse columns in SQL Server 2008
Determining the source of full transaction logs in SQL Server
New GROUP BY option provides better data control in SQL Server 2008
Using the OPENROWSET function in SQL Server
Loading data files with SQL Server's BULK INSERT statement
Importing and exporting bulk data with SQL Server's bcp utility
SQL/Transact SQL (T-SQL) Research

SQL Server Stored Procedures
SQL Server Mailbag: CALs, witnesses and unwanted changes
SQL Server Mailbag: Stored procedures, triggers and SSRS reports
Top tips and tricks for SQL Server database development
Top 10 SQL Server development tips of 2008
SQL Server errors, failures and other problems fixed from the trenches
SQL Server and data manipulation in T-SQL
How to use SQL Server 2008 hierarchyid data type
SQL Server stored procedures tutorial: Write, tune and get examples
Check SQL Server database and log file size with this stored procedure
SQL Server source code analysis and management adds database security

Archive: Reporting Services
Tips for tuning SQL Server 2005 to improve reporting performance
Manipulate column names in a SQL Server table
Licensing a standby server for SQL Server replication
Can I encrypt and restore a database backup in SQL Server 2005?
Storing and searching for image files in SQL Server
Using BULK INSERT to insert rows from SQL Server dataset to table
SQL Server query to import database names
Troubleshoot SQL Server 2005 SP2 installation error
Workaround to Reporting Services error in SQL Server Express
How can I export stored procedures in SQL Server 2005?

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
ACID  (SearchSQLServer.com)
Collaboration Data Objects  (SearchSQLServer.com)
commit  (SearchSQLServer.com)
container  (SearchSQLServer.com)
DAO  (SearchSQLServer.com)
fetch  (SearchSQLServer.com)
OLE DB  (SearchSQLServer.com)
query  (SearchSQLServer.com)
SQL  (SearchSQLServer.com)
T-SQL  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


A trigger would not work well in this example. A trigger executes when you perform an INSERT/UPDATE/SELECT command on a row or rows of data, and it is typically only used in relation to the data just updated. If the data is not updated, no trigger would fire, either. In your case, it seems that you need something like a notification, instead.

I would develop a stored procedure to return the count of items too close to the warranty expire date. In the query, I would use the DATEDIFF function to find out if there are any matching rows. Then, I would create a scheduled job and have an email sent to me if the count is greater than zero.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SQL Solutions - SQL Database Design
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts