在sql server中如何再次收到1号 [英] in sql server how to receipt number 1 again

查看:87
本文介绍了在sql server中如何再次收到1号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库设计如下;



收据ID文本

账单无文字

收据金额< br $>




在数据库中从收据ID开始1到1000条记录在数据库中。



我想再次以收据ID开始1.



我该怎么办?我已经在数据库中有1000条记录。从1到1000条记录开始。



我该怎么办?



请帮助我。



问候,

Narasiman P

Database design as follows;

Receipt Id text
Bill No text
Receipt Amt Number


In database starting from Receipt id 1 to 1000 records are there in the database.

I want again the receipt id again start with 1.

how can i do? already i have 1000 records in the database. starting from 1 to 1000 records.

how can i do?

Please help me.

Regards,
Narasiman P

推荐答案

如果 ID 是您数据库中的主键,然后您不能,否则由您和您的应用程序进行编号。



一般来说,最好不要依赖主键,并且出于这个原因拥有自己的编号。
If ID is the primary key in your database then you can''t, otherwise it is up to you and your application to do the numbering.

Generally it is a better idea not to rely on the primary key, and have your own numbering for this very reason.


请阅读Mehdi Gholam解决方案。



试试这个:

Please, read Mehdi Gholam solution.

Try this:
SELECT [Receipt Id], [Bill No], [Receipt Amt Number]
FROM YourTable
WHERE [Receipt Amt Number] = 1


这篇关于在sql server中如何再次收到1号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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