SQLServer逻辑设计问题 [英] Sqlserver logical design problem

查看:89
本文介绍了SQLServer逻辑设计问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.

我打算通过Asp.net设计一个表单,让员工插入他们的个人信息,然后将这些数据存储在DB(Sqlserver 2008r2)中.

在我的数据库逻辑设计中,我应该是:(PersonelCode,Int,pk,unique,not null)
但我的问题是:有人告诉我PersonelCode数据类型不应为Int,因为其中一些包含单词或从零开始(例如:0343),
那我该怎么办,将数据类型更改为String是否正确?如果是,如何保持其唯一性并指定人的身份?

Hi.

I intend to design a form by Asp.net that employees insert their personal information , and then these data to be stored in DB(Sqlserver 2008r2).

in my DB logical design , i had supposed to be:(PersonelCode,Int, pk,unique,not null)
but my problem is : someone told me that PersonelCode datatype shouldn''t be Int, because some of them include words, or begin from Zero(example: 0343),
so what shall i do , is it correct to change the datatype to String ? if yes , how can keep it unique and to specify person''s identificaion?

推荐答案

将其保留为字符串..插入之前,请检查插入过程中是否已经存在存在...否则它将引发sql异常...如果使用字符串,您将在实现方面具有灵活性,因为它比int易于管理,例如比较,用于搜索,例如模式....
Keep it as string ..before insertion check in insertion procedure if it is already exists...otherwise it will throw sql exception...you will have flexibility in implementing if you use string since it is easy to manage than int for e.g. compare ,use in search like patterns....


这篇关于SQLServer逻辑设计问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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