rmatthew Posted January 26, 2006 Posted January 26, 2006 In MSSQL is it possible to set the default value of a column to a function of another column (ie. max([field]) + 1)? If so... how? Quote
Igor Sukhov Posted January 28, 2006 Posted January 28, 2006 In MSSQL is it possible to set the default value of a column to a function of another column (ie. max([field]) + 1)? If so... how? Create FOR INSERT trigger for this table. In trigger's code update value of the column. Quote
Administrators PlausiblyDamp Posted January 29, 2006 Administrators Posted January 29, 2006 A default constraint cannot access inforamtion outside of the row itself, however if you create a User Defined Function that does access something like MAX([whatever]) + 1 this can be used in a default constraint. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.