如何自动更新数据库. [英] how to update database automatically.

查看:161
本文介绍了如何自动更新数据库.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要一个触发器,该触发器可以通过检查存储在该文件中的日期来更新表行字段,而无需用户进行任何交互.即我正在一个项目中,我必须在特定的日期n次为用户预订房间,在那种情况下,我希望将房间状态显示为已预订",但是在该日期n次过期后,我们的数据库会自动更新房间状态从预订"到可用".表示我希望该数据库跟踪那里的记录并自动对其进行更新.所以请帮助我如何对其进行存档.

如果有任何人可以帮助我...对我来说很紧急.
在此先感谢您.

Hi,

I need a trigger that updates a table row field by checking date that is store in there own filed without any interaction of user. i.e i am working on a project where i have to book rooms for user for a particular date n time and at that case i wnt to show room status as a "booked" but after expiry of that date n time our database automatically update room status "booked" to "available". means i want that database keep track of there record and update it automatically.so please help me how i can archive it.

please help me if any one can...its urgent for me.
Thanks in advance.

推荐答案

您需要为操作创建一个Store Proc.然后在您的SQL Server数据库中创建一个计划作业.然后设置计划时间"以在此时间后运行Store Proc,并将"Store Proc to Schedule"命令设置为
. 说明:
打开您的服务器的SQL Server企业管理器.依次展开管理,SQL Server代理,然后单击作业.右键单击它,然后选择新建作业.您将获得一个屏幕,您可以在其中安排各种SQL Server命令,包括运行SQL代码.对于该过程,创建一个Transact SQL Script类型的新步骤,然后键入该过程的名称...
You need to create a Store Proc for your operation. Then Create a Schedule Job in your SQL Server database. Then set Schedule time to run your Store Proc after that time and set your Store Proc to Schedule command.
Instruction:
Open the SQL Server Enterprise manager for your server. Expand Management, then SQL Server agent and then click Jobs. Right-click it and choose New Job. You get a screen where you can schedule various SQL Server commands, including running SQL code. For the procedure, create a new step of type Transact SQL Script and type the name of the procedure...


这篇关于如何自动更新数据库.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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