根据月份重置ID [英] Reset the ID based on the Month

查看:72
本文介绍了根据月份重置ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想每个月重置S.No。对于每月,它将从1开始,一个月的最大id值为9999.



请尽快回复。

谢谢

I want reset the S.No for every month. For Every month it will start from 1 and the maximum id value for one month is 9999.

Please reply as soon as possible.
Thank You

推荐答案

如果您正在尝试重置标识列,那么虽然有办法使用DBCC命令此外它不应该是你的主键。



或者如果它只是维持增量数的普通列,那么检查最后一个id是否是超过9999然后再插入1。
If your are trying to reset the identity column it is a bad idea though there is a way to reset it using DBCC command moreover it shouldn't be your primary key.

Or if it is just a normal column to maintain the incremental number then check for the last id if it is exceeding 9999 and then insert it with 1 again.


这篇关于根据月份重置ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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