How can implement msacess mask like functionality in SQL Server
I have some dynamic forms and fields in a web reporting tool. I am adding column to SQL Server tables I need validation of data inputs. Say 开发者_JAVA技巧when I adding a email address filed to a SQL Server table email adress validation should be attached to that field. I want functionality like MS-Access mask in the time of adding filed to a Access table.
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). 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.
This "mask" feature is not a substitute for CHECK() constraints in the dbms. 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. 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.
Second, it prevents sleep-deprived DBAs from making certain kinds of disastrous mistakes.
精彩评论