On Tue, Jan 8, 2013 at 10:02 AM, Paul Newton <paul.new...@pegasus.co.uk>wrote:
> Hi all > > The following is a column definition (part of a create table statement in > Transact-SQL > > [wp_pssslip] [int] NOT NULL CONSTRAINT > [DF_wparm_wp_pssslip] DEFAULT (24) > > I want the default value for this field to be the lesser of 24 and the > value of another field (wp_summpp) > > I have no idea if this is possible or how I would go about it so any > suggestions would be highly appreciated > > The only clue I have from the help is this: > > "Only a constant value, such as a character string; a scalar function > (either a system, user-defined, or CLR function); or NULL can be used as a > default." > ------------------------- Two options. Make the UDF that executes the code for default value or put that code into a trigger after insert. Drop constraint DF_wparm_wp_pssslip to stop what is happening now. -- Stephen Russell Sr. Analyst Ring Container Technology Oakland TN 901.246-0159 cell --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cajidmylvbc7r83peag06qge315zhr71xwqbv7kq0-hhofgm...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.