Help with a trigger - calculated column

Posted on 2013-10-22
Last Modified: 2013-10-22
I have a table with an end date column and a  long value that is a status.  I want to set the status to a specific value whenever the current date is great than the end date.  I know how to create a calculated column, but that requires a value in a column to change.  How do I trigger a value change based on the current date?
Question by:HLRosenberger
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 65

Expert Comment

by:Jim Horn
ID: 39590925
>but that requires a value in a column to change.
Explain why this matters, as it's not clear why a calculated column can not meet your requirements.

Author Comment

ID: 39590988
I could be all wet.   How/when does the comparision of the end date to current date take place?  I mean what triggers that?
LVL 65

Accepted Solution

Jim Horn earned 500 total points
ID: 39591027
A trigger will fire when row(s) are inserted-updated-deleted, and gives the developer full control over what happens for the set of rows that are inserted-updated-deleted, and not for every row.

A calculated column is calculated on select, so in effect every time you access the column.

Author Comment

ID: 39592298
Ah, so calculated should work then,   Thanks.

Author Closing Comment

ID: 39592299

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL: Wrong Result 7 39
VMware PVSCSI SQL Server 2016 AlwaysOn 2 37
Failover Cluster Primary Nodes Current Vote = 0 5 36
Group ordersum by orderdate 3 18
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

739 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