生成唯一的 9 位数字值 [英] Generate unique 9 digits values

查看:56
本文介绍了生成唯一的 9 位数字值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张如下所示的表格:

I have a table as shown below:

Group           
---------------------------     
Id  Num         Name    Age
---------------------------
1   424000000   Damine  22
2   324000000   Arshley 18
3   276000000   Tita    20
4   424000000   Helen   21
5   424000000   Mary    19
6   324000000   Kathe   20
7   324000000   Mark    18
8   276000000   Phill   22

我想让 Num col 唯一,所以我需要为重复项生成 9 位数字随机值.

i want to make the Num col unique so i need to generate 9 digit numeric random values for the duplicates.

请帮忙,谢谢

推荐答案

您可以将 num 列设置为具有 100000000 之类的种子的标识字段,或者只是将 num 字段设置为标识并使用重载的 tostring 方法打印其值

you set the num column as an identity field with a seed like 100000000 or just set the num field to an identity and print its value with an overloaded tostring method

更新:通过 Management Studio 执行此操作(添加标识列)将删除并重新创建表,不建议在非常非常大的表上这样做

Update: doing this (adding an identity column) through Management Studio will drop and recreate the table, which is not recommended on a very very large table

这篇关于生成唯一的 9 位数字值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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