|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
[REPOST] SMO Table Scripts -- Defaults and Binding Rulesthe column default field values or how to bind the user defined rules to the columns. I'm using the options shown below: --------------------------------- _createOptions.ClusteredIndexes = true; _createOptions.Default = true; _createOptions.Indexes = true; _createOptions.NonClusteredIndexes = true; _createOptions.Permissions = true; _createOptions.PrimaryObject = true; _createOptions.SchemaQualify = true; _createOptions.SchemaQualifyForeignKeysReferences = true; _createOptions.ScriptDrops = false; _createOptions.Triggers = true; table.Script(_createOptions) --------------------------------- Here are the parts I'm missing: --------------------------------- ALTER TABLE [dbo].[PERSON] ADD CONSTRAINT [DF_PERSON_FirstName] DEFAULT ('FIRST') FOR [FirstName] GO setuser GO EXEC sp_bindrule N'[dbo].[RULE_BOOLEAN]', N'[PERSON].[Flag]' GO EXEC sp_bindefault N'[dbo].[DEF_NO]', N'[PERSON].[Flag]' GO EXEC sp_bindefault N'[dbo].[DEF_ID]', N'[PERSON].[OriginID]' GO EXEC sp_bindefault N'[dbo].[DEF_ID]', N'[PERSON].[OwnerID]' GO EXEC sp_bindefault N'[dbo].[DEF_TODAY_UTC]', N'[PERSON].[Timestamp]' GO EXEC sp_bindrule N'[dbo].[RULE_BOOLEAN]', N'[PERSON].[VerifySSN]' GO EXEC sp_bindefault N'[dbo].[DEF_NO]', N'[PERSON].[VerifySSN]' GO EXEC sp_bindrule N'[dbo].[RULE_BOOLEAN]', N'[PERSON].[WorkBadAddress]' GO EXEC sp_bindefault N'[dbo].[DEF_NO]', N'[PERSON].[WorkBadAddress]' GO setuser GO --------------------------------- Thanks. Scott C. Hi Scott,
Thanks for your repro code. I can reproduce it on my machine sucessfully. Currently, I'm trying to contact the product group for information on this issue. And I will let you know as soon as they give me any suggestion. Thanks! Kevin Yu Microsoft Online Community Support ============================================================================ ========================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ============================================================================ ========================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Hi Scott,
Please try to set the DriDefault property to true. I tested it, and it works fine on my machine. Kevin Yu Microsoft Online Community Support ============================================================================ ========================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ============================================================================ ========================== (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|||||||||||||||||||||||