在Sql Server 2005中确定的时间后,列如何更改其值 [英] How a column change its value after a determined time in Sql Server 2005

查看:51
本文介绍了在Sql Server 2005中确定的时间后,列如何更改其值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表(tblMessage),其中包含列(id,title,contents,publishingDateTime,status)。 publishingDateTime列是消息将发布的日期。我想在到达publishDateTime时自动从(挂起到已发布 - 或 - 从false更改为true)更改列(状态)的值。



如何在Sql Server 2005中有可能吗?

I have a table (tblMessage) with columns (id, title, contents, publishingDateTime, status). The publishingDateTime column is the Date in which the message will publish. I want to change the value of column (status) automatically from (pending to published - OR - from false to true) when it is reached to its publishingDateTime.

How it is possible in Sql Server 2005?

推荐答案

您好,



您需要更改状态列在表中计算字段。这需要计算如下:



Hi,

You need to change the status column in the table to a calculated field. This will need to be calculated like:

Case when publishingdatetime

This will result in 0 if pending or 1 if published.

If you prefer you can replace the 0 and 1 in the calculation to pending or published and then the status column will return the text instead


这篇关于在Sql Server 2005中确定的时间后,列如何更改其值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆