I am using Power Designer to create a database model. In one of my tables, I have created a Check constraint that calls a function to validate the attribute. The script for my table creation looks like this
create table tbl_Inventory (
Id int identity,
Name VARCHAR(50) not null
constraint CK_Inventory_Name check (([dbo].[fn_CheckNameComplexLogic]([Name]) = 1)),
constraint PK_Inventory primary key (Id),
)
I have also created a function fn_CheckNameComplexLogic
that performs the check.
When I try to use the code generation tool by going Database->Generate Database. The generated code always place create table
before create function
. Because my table depends on the function, the scripts always errors out. I could manually edit the generated code, but I am wondering if there is a place in PowerDesigner for configuring this.
Thanks for your help.