sqlserver datatime value plus random number
If we want to make some identiity value in sqlserver , we can use identity data type in a table.
However, there are some disadvantages on that style,
But , how to ?
Here we go
we can use
replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
to get time as char
result is: 20170210000222
And we can use replace(CONVERT(uniqueidentifier,NewID(), 120 ),'-','')
to gert random number conver to char
How about to make they together
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','') + replace(CONVERT(uniqueidentifier,NewID(), 120 ),'-','')
That result like 20170210000436590385B62DDD4D4B9ABB8009BDEDDD40
Then you can make it The result is unqiue and easy to management it.
sqlserver datatime value plus random number的更多相关文章
- Random number
Original #include <stdlib.h> #include <time.h> srand(time(NULL)); rand(); The versions o ...
- How to generate a random number in R
Generate a random number between 5.0 and 7.5x1 <- runif(1, 5.0, 7.5) # 参数1表示产生一个随机数x2 <- runif ...
- Linux shell get random number
the Shell Profile: When a new interactive shell is started, /etc/profile, followed by /etc/bash.bash ...
- Case Study: Random Number Generation(翻译教材)
很荣幸,经过三天的努力.终于把自己翻译的教材做完了,现在把它贴出来,希望能指出其中的不足. Case Study: Random Number Generation Fig. 6.7 C++ 标 ...
- C# random(number)
C#随机函数Random()的用法 出自:http://www.cnblogs.com/wang726zq/archive/2012/04/28/2474711.html http://blog.cs ...
- ISO C Random Number Functions
This section describes the random number functions that are part of the ISO C standard. To use these ...
- LoadRunner压力测试之Unique Number参数类型、Random Number参数类型浅析
前几天工作需要用LoadRunner进行压力测试,期间对手机号进行参数化设置. 当时选用了<Value>137{Random_quhao}{Unique_weiyi}</Value& ...
- 文献翻译|Design of True Random Number Generator Based on Multi-stage Feedback Ring Oscillator(基于多级反馈环形振荡器的真随机数发生器设计)
基于多级反馈环形振荡器的真随机数发生器设计 摘要 真随机数生成器(trng)在加密系统中起着重要的作用.本文提出了一种在现场可编程门阵列(FPGA)上生成真随机数的新方法,该方法以 多级反馈环形振荡器 ...
- Python(正则 Time datatime os sys random json pickle模块)
正则表达式: import re #导入模块名 p = re.compile(-]代表匹配0至9的任意一个数字, 所以这里的意思是对传进来的字符串进行匹配,如果这个字符串的开头第一个字符是数字,就代表 ...
随机推荐
- 学习集合Collection_通用方法
Collection 常用接口 集合List和Set通用的方法 public boolean add(E e) 添加对象到集合 public boolean remove(E e) 删除指定元素 pu ...
- echarts设置网格线颜色
xAxis: { type: 'value', //设置网格线颜色 splitLine: { show: true, lineStyle:{ color: ['#315070'], width: 1, ...
- python实现浏览器打开指定url
关键 webbrowser+time+os import os,timeimport webbrowser url = 'http://www.baidu.com' webbrowser.op ...
- scope为provided
以下面dependency为例 1 <dependency> 2 <groupId>javax.servlet</groupId> 3 <artifactId ...
- 解决 VS Code 中 golang.org 被墙导致的 Go 插件安装失败问题
微软官方开发的 Go for Visual Studio Code 插件为 Go 语言 提供了丰富的支持.在 VS Code 中首次打开 Go 工作区后,VS Code 会自动检测当前开发环境为 Go ...
- 软工作业-14组铁大FaceBook网站使用体验
铁大facebook是面向铁道大学学生的一个空间网站,空间界面十分朴素,灰色的色调.基本可以满足日常的发动态需求,但也存在一些问题: 比如发动态不是很方便,必须要进入到某一个空间才能发动态 .就有一些 ...
- [洛谷P2962] [USACO09NOV] 灯Lights
Description Bessie and the cows were playing games in the barn, but the power was reset and the ligh ...
- 第二阶段冲刺个人任务——five
今日任务: 合并程序(统计团队博客). 昨日成果: 优化统计团队博客结果界面的显示.
- set去重
public static void main(String[] args){ List<String> list = new ArrayList<String>(); lis ...
- ERR : undefined reference to something
序言: define : 定义.相信你用过 #define PI 3.141592653 (千万记得别在这句代码后加分号) reference : 引用 undefined reference to ...