什么是创建新ID的最佳方法 [英] what is the Best way to create a new ID

查看:86
本文介绍了什么是创建新ID的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的导师,
这是我在这里的第一篇文章,但是我从这里学到了很多.

我在前端的sql server express 2005数据库和vb.net 2008应用程序中有一个表"tblUserRequest".表结构如下:RequestID,UserID,RequestBody.

用户正在tblUserRequest中提交他们的查询.我的问题是创建RequestID的最佳策略是什么?我应该从vb应用程序创建新ID,然后保存所有数据,还是使用存储过程?

我的目标是确保不插入任何重复值.我不想使用自动增量数据类型.

对不起,我的语言不好.

SKPaul

Dear mentors,
This is my first posting here, though, i have learnt a lot from here.

I have a table "tblUserRequest" in sql server express 2005 database and vb.net 2008 application in front end. Table structure is the following: RequestID, UserID, RequestBody.

Users are submitting their queries in tblUserRequest. My question is what is the best policy to create RequestID? Shall i create new id from vb app then save all the data, or use stored procedure?

My objective is to ensure that no duplicate value is inserted. I don''t want to use auto increment datatype.

Sorry for my poor language.

SKPaul

推荐答案

看看下面提到的链接.

我认为您可以使用其中之一.

随机数生成方法 [使用SQL Server生成随机数 [
Take a look at the below mentioned links.

I think you can make use of one of them.

Random Number Generation Methods[^]

Random Number Generation Using SQL Server [^]

Hope these links will help you.

BR//
Harsha


这篇关于什么是创建新ID的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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