我为数据库中的每个用户生成了一个唯一的8位数字,如下所示:
3位前缀|任意数字btw 01 & 99 |顺序生成的3位数字。
示例: 234 | 74 | 216 ==> 23474216
因为我想让用户容易记住这个数字,所以我打算只向用户发出8个数字中的6个数字。例如,使用上面的数字23474216,用户得到234742。
问题的症结在于,用户必须仅依靠这6个数字才能访问系统。没有密码。
那么,我如何在数据库中将6位数字与正确的8位数字进行匹配呢?
提前谢谢。
发布于 2021-07-16 02:49:00
举个例子
Declare @p int = 23474216
select
@p as [number]
, @p/100 as [short] -- because it is int type it will drop decimals
-- if you have type string - use Substring()
, Substring('23474216', 1, 6) as [string value]
https://stackoverflow.com/questions/68399052
复制相似问题