manual set primary key field

Posts   
 
    
mdissel
User
Posts: 92
Joined: 16-Sep-2003
# Posted on: 21-Jan-2008 10:27:38   

I've got a legacy database that i want to use with llblgen. The tables in the database don't have a primary key and/or foreign keys.

I can manually create relations, but relations can only point to primary key columns.

How can i manually add a relation without a primary key column? or How can i manually set a primary key column?

Thanks

Marco

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 21-Jan-2008 10:46:00   

In the Designer, you can select a field and check the Is part of primary key check box.

mdissel
User
Posts: 92
Joined: 16-Sep-2003
# Posted on: 21-Jan-2008 11:25:24   

That option is grayed out.. the field has isnullable = true, isidentity = false , iscomputed = false, isreadonly = false, ispk = false

(the table is used by an application with it's own logic for validation and creating pk's)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 21-Jan-2008 13:08:26   

nullable fields can't be a PK, as a PK can't be NULL.

Frans Bouma | Lead developer LLBLGen Pro
mdissel
User
Posts: 92
Joined: 16-Sep-2003
# Posted on: 21-Jan-2008 13:38:54   

That's correct, but the legacy database is defined as is.. I can't change that.

Is it correct to conclude that in this case (field accepts null) it's not possible to define the relationship in the designer?

Thanks Marco

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 21-Jan-2008 15:42:54   

Yes, unfortunately in this case you wont' be able to create the relationships in the designer unless you're able to change the null flag in those fields (dbms).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 21-Jan-2008 16:01:34   

One trick you can do is to create a similar schema in another catalog or under a different name, there, fix the minor issues and create the llblgen pro project from that schema, then at runtime simply use catalog/schema name overwriting to target the original schema. simple_smile

Frans Bouma | Lead developer LLBLGen Pro