如何使用存储过程验证列 [英] How to validate a column using stored procedure

查看:46
本文介绍了如何使用存储过程验证列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名称Room_type,有效的房间类型是卧室,餐厅,客厅,厨房,浴室。


我必须验证room_type列,这样才有效房间类型是允许的。

I have a column name Room_type ,the valid room types are bedroom,dining room,living room,kitchen,bathroom.

I have to validate the room_type column such that only valid room types are allowed.

推荐答案

问题是输入了无效数据。我假设在前端。

这可以通过这种设计使其无法实现
The problem is that invalid data has been entered.I am assuming at the front end.
This can be rendered impossible by this design
展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


然后在两个表之间创建一个关系(FK - to - PK)。


- CK
Then create a relationship (FK - to - PK) between the two table.

-- CK


它不像我必须写一个程序,在我应该能够插入一个房间,插入时我应该看到房间类型是有效的。


我已经列出的有效类型。


我不能再使用一个表
its not like that i have to write a procedure where in i should be able to insert a room and while inserting i should see that room type is valid.

valid types i have listed already.

I cannot use one more table


这篇关于如何使用存储过程验证列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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