Skip to main content
Solved

Is there a way to make a column primary key when the table/view is already created?

  • March 27, 2024
  • 1 reply
  • 34 views

Alieev
Rookie
Forum|alt.badge.img

Is there a way to make a column “primary key” even when the table already existed with no primary keys at all? 

There are things you have to consider, right? 

  • All the already existing data needs to be formatted to this new primary key, so it can’t be null
    • So how do you alter this data? Do you have to manually do this in data conversion or SSMS?

Best answer by Mark Jongeling

Hi Alieev,

Certainly! Simply check the Primary key checkbox at all fields that should be in the Primary key in the Software Factory, Datamodel > Tables > Columns. More info here: Data model | Thinkwise Documentation (thinkwisesoftware.com)

The Software Factory will upgrade the table for you when you start and finish a whole Creation cycle (Generate definition, Validate definition, Generate source code (Smart or Full, both work), and lastly Execute source code). 

If data needs to be migrated, you can use Data migration to determine how old fields should be mapped to new fields. More info here: Data migration | Thinkwise Documentation (thinkwisesoftware.com)

In more complex scenarios, you can even opt to use an Upgrade control procedure. More info on that here: Functionality | Thinkwise Documentation (thinkwisesoftware.com)

View original
This topic has been closed for comments

Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hi Alieev,

Certainly! Simply check the Primary key checkbox at all fields that should be in the Primary key in the Software Factory, Datamodel > Tables > Columns. More info here: Data model | Thinkwise Documentation (thinkwisesoftware.com)

The Software Factory will upgrade the table for you when you start and finish a whole Creation cycle (Generate definition, Validate definition, Generate source code (Smart or Full, both work), and lastly Execute source code). 

If data needs to be migrated, you can use Data migration to determine how old fields should be mapped to new fields. More info here: Data migration | Thinkwise Documentation (thinkwisesoftware.com)

In more complex scenarios, you can even opt to use an Upgrade control procedure. More info on that here: Functionality | Thinkwise Documentation (thinkwisesoftware.com)


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings