简体   繁体   English

如何在SQL Server中实现类似msacess掩码的功能

[英]How can implement msacess mask like functionality in SQL Server

I have some dynamic forms and fields in a web reporting tool. Web报表工具中有一些动态表单和字段。 I am adding column to SQL Server tables I need validation of data inputs. 我在SQL Server表中添加列,我需要验证数据输入。 Say when I adding a email address filed to a SQL Server table email adress validation should be attached to that field. 说当我添加归档到SQL Server表的电子邮件地址时,电子邮件地址验证应附加到该字段。 I want functionality like MS-Access mask in the time of adding filed to a Access table. 在将文件添加到Access表时,我想要像MS-Access掩码这样的功能。

MS Access is best thought of as three separate products--a dbms, a rapid application development environment for user interfaces to many different dbms, and a programming environment (VBA). 最好将MS Access视为三种独立的产品-dbms,用于与许多不同dbms的用户界面的快速应用程序开发环境以及编程环境(VBA)。 The "mask" you're talking about is a user interface feature. 您正在谈论的“掩码”是用户界面功能。 SQL Server doesn't have any UI development features, so you have to do that work yourself in whatever user interface you're building. SQL Server没有任何UI开发功能,因此您必须在正在构建的任何用户界面中自行完成此工作。

This "mask" feature is not a substitute for CHECK() constraints in the dbms. 此“掩码”功能不能替代dbms中的CHECK()约束。 In other words, build an email mask in your front end, but also build a compatible CHECK() constraint on the email column in the database itself. 换句话说,在您的前端构建一个电子邮件掩码,但还要在数据库本身的电子邮件列中构建兼容的CHECK()约束。 There are two good reasons to do that. 这样做有两个很好的理由。

First, because useful database applications extend their reach. 首先,因为有用的数据库应用程序扩展了它们的范围。 You'll find more and more user interfaces connecting to a useful database. 您会发现越来越多的用户界面连接到有用的数据库。 (The last legacy db I worked on had user interfaces written in 15 different programming languages , dating from the early 1970s.) You can't count on new interfaces to follow the rules of your one interface. (我研究的最后一个旧数据库具有用15种不同的编程语言编写的用户界面,其历史可以追溯到1970年代初期。)您不能指望新界面来遵循您的一个界面的规则。

Second, it prevents sleep-deprived DBAs from making certain kinds of disastrous mistakes. 其次,它可以防止睡眠不足的DBA犯某些灾难性的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM