on 2010 Jan 26 11:57 AM
How many times have you wanted to code something like this?
DECLARE @upgrade_ok VARCHAR ( 1 ) NOT NULL DEFAULT 'Y' CHECK ( @upgrade_ok IN ( 'Y', 'N' ) );
If you're like me, lotsa times. In fact, quite a few times I have coded NOT NULL... on purpose, not by accident.
Yes please - tried to write that but yesterday before realising you can't do it!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What about FKs, i.e. something like
CHECK (@value IN (SELECT pk FROM myTable));
I haven't had such requirement but that works with checks on columns and should then work with checks on local variables...
(Note, for columns, one would use a FOREIGN KEY constraint here, I know, but a check with a sub-select to a different table is possible, too, and senseful in some cases where a FK can't be used´).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.