本文介绍了如何每个新月自动更新一个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有促销大师表,其中包括会员,银牌,金牌,绿宝石,钻石和皇冠等促销,

每个用户在注册时都被视为会员。

我必须每月在注册表中推广他们的促销活动





我有一张桌子,如图所示,



促销主表:

I have a Promotion Master table with promotion like Member,Silver,Gold,Emerald,Diamond and Crown etc.,
Each users consider as a "Member" at their registration.
I have to promote their promotion every month in Registration Table


I Have a tables as shown,

Promotion Master Table:

Promotion_Id         Promotion_Name        

1                     Member
2                     Silver
3                     Gold
4                     Emerald
5                     Diamond
6                     Crown







用户注册表:




User Registration Table:

UserId                  Name                Promotion_ID

1                     Rajesh                Member
2                     Nelson                Silver





促销ID应每月自动更新到下一级促销。



Ex:



如果客户在2014年8月31日注册成为会员,则其促销活动应于2014年9月1日从会员更改为银牌



如果它是白银它应该改为黄金



我正在使用Sql server 2008R2



在此先感谢,

Rajesh



Promotion Id should auto update every month to next level of promotion.

For Ex:

If a customer register as a Member in 31 st August 2014 , his promotion should change from "Member" to "Silver" on September 01 2014

If it is "silver" it should change to "Gold"

I'm using Sql server 2008R2

Thanks in Advance,
Rajesh

推荐答案

create procedure dbo.update_table
as 
begin 
update PromotionMasterTable
set Promotion_Name ='Silver'
where Promotion_Name ='Member'




这篇关于如何每个新月自动更新一个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-20 22:23