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.
asked 26 Jan '10, 11:57
Yes please - tried to write that but yesterday before realising you can't do it!!
answered 27 Jan '10, 17:10
What about FKs, i.e. something like
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´).
answered 28 Jan '10, 15:10