Toad World® Forums

inline constraints on table generation?

Hello


-- Table Pac_PAVE_MODEL_LINE
CREATE TABLE "Pac_PAVE_MODEL_LINE"(
"paml_id" Number NOT NULL,
"MOLI_ID" Number(18,0) NOT NULL,
"pmlc_id" Number,
"version_nr" Number
)
/
-- Add keys for table Pac_PAVE_MODEL_LINE
ALTER TABLE "Pac_PAVE_MODEL_LINE" ADD CONSTRAINT "pac_moli_pk" PRIMARY KEY ("paml_id")
/

TDM generates alter statements when a new table has constraints (like PK/FK uniqueness and alike):
``


-- Table Pac_PAVE_MODEL_LINE
CREATE TABLE "Pac_PAVE_MODEL_LINE"(
"paml_id" Number NOT NULL,
"MOLI_ID" Number(18,0) NOT NULL,
"pmlc_id" Number,
"version_nr" Number
, CONSTRAINT "pac_moli_pk" PRIMARY KEY ("paml_id")
)
/

I’d rather like them inline in the Table script:
``

how to i configure TDM to place constraints inline in new tables?

Thanks!

bye
Thomas

Hi Thomas,

Go to Model Menu | Order of Generated Objects and change the Value for Keys to Inside CREATE TABLE Statement. Then, the code should be generated as you want.

Regards,

Lukas

Thanks Lukas, you saved my day.

This is needed in case one is using temporal tables in SQL SERVER.

Toad devs, may I suggest this to be the default, at least for tables with system versioning enabled? Otherwise the script will always fail. And please improve the way this configuration screen was made. If Lukas hadn’t said it was possible to change the value, I would never know there was a combo box in there. And even after I knew, it was still very hard to use it. I am still not sure of the correct place I should click for the combo box to appear. All I know is that it eventually appeared :slight_smile:

Hello Fernando,

In generating entities with system versioning (for Microsoft SQL Server 2016) is now modification. Key will be generate always inline, regardless of the settings.
This modification will be available in next Beta version.

Daril