Toad World® Forums

Table ddl extraction


#1

When extracting the ddl for a table, if the column uses a user datatype not lengh should be specified.

Would it also be possible to extract the sp_primarykey and sp_foreignkey declarations ?

EXEC sp_addtype ‘INDIC’,‘bit’,‘NOT NULL’
EXEC sp_addtype ‘NOM’,‘varchar(30)’,‘NOT NULL’
EXEC sp_addtype ‘INFO_ID_PT’,‘smallint’,‘NOT NULL’
go

The create script

CREATE TABLE dbo.SYST_ANC_TAB
(
TAB_NOM NOM NOT NULL,
REF_TAB_INDIC INDIC NOT NULL,
CONV_TYP_ID INFO_ID_TINY NOT NULL,
TAB_NOM_NOUV NOM NULL
)
LOCK ALLPAGES
go
EXEC sp_primarykey ‘dbo.SYST_ANC_TAB’, TAB_NOM
go
EXEC sp_foreignkey ‘dbo.SYST_ANC_TAB’, ‘dbo.CONV_TYP’, CONV_TYP_ID
go
EXEC sp_foreignkey ‘dbo.SYST_ANC_TAB’, ‘dbo.SYST_NOUV_TAB’, TAB_NOM_NOUV
go

The extracted script

create table SYST_ANC_TAB (
TAB_NOM NOM(30) not null,
REF_TAB_INDIC INDIC not null,
CONV_TYP_ID INFO_ID_TINY not null,
TAB_NOM_NOUV NOM(30) null
)
lock allpages


#2

Hello Jean-Pierre,

I went ahead and created CR 81,947 for this issue.

Thanks.


#3

Hello Jean-Pierre,

This issue will be resolved in the next beta.

Thanks.


#4

I’d like to see in the extracted “create table” script column’s default value if it exists.

Thanks,
Raisa


#5

Hello RaisaD,

We currently have CR 80,038 for this issue and we will look into adding it for version 1.0.

Thanks.