Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2004, 10:18 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use Begin_Date to update End_Date field (+90days)

I am new to triggers and scripts.
I have a table that contains 2 fields. Begin_Date and End_Date.
The Begin_date is entered into SQL 2003 via a front end software program.

ON entry of the begin date is is possible to have a trigger fire that would automatically populate the End_Date field with the following result. End_date = Begin_Date +90 Days.

Could you recommend a procedure and possible script.

Regards,

ColdPolarBear

 
Old December 9th, 2004, 11:17 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

You can add this to your trigger

Code:
Update your table
set End_date=Begin_date +90
Recommendation

1. Make sure you have a where clause for the records you want to update
2. Are updating just new records or existing records
3. If this will be your default use a constraints

Jaime E. Maccou





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Date Field desireemm Access 1 October 16th, 2005 12:25 AM
Table field update ibelta Access 4 February 12th, 2005 08:22 PM
Trying to update a date field jfrizelle Classic ASP Databases 3 November 4th, 2004 08:55 AM
Update city field based on zip field nganb SQL Server ASP 0 April 22nd, 2004 10:30 PM
Update a date field levinll SQL Language 1 January 16th, 2004 02:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.