I don't know if there's a way to determine the name of an existing primary key, so I can't help you there.
However, in the future I recommend using the AddPrimayKey method instead. It lets you specify a name for the primary key. I think there may be a bug in the primary key creation doing it the way you are. I seem to recall that if you specify a multi-column primary key it actually chooses a predictable name (much like SQL Server does), but for some reason a single-column key gets the random name. On Jun 17, 6:13 am, Антон <[email protected]> wrote: > I've created column like this: > new Column("Column1", System.Data.DbType.String, > ColumnProperty.PrimaryKey) > > Now I need to remove primary key constraint from this column and > create primary key for another one. > The problem is that generated primary key has random name like this: > PK__TableName__6D0E29E15DCAEF64 > And it changes from database to database. > > How to find out the name of the primary key dynamically? > I'm using MS SQL. -- You received this message because you are subscribed to the Google Groups "migratordotnet-devel" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/migratordotnet-devel?hl=en.
