Home > database >  Don't know "select 1 from sys. Systable where table_name" what meaning be
Don't know "select 1 from sys. Systable where table_name" what meaning be

Time:10-12

Design good physical data model, after the export SQL statements, see the following statement in the exported file,
 if the exists (select 1 from sys. Systable where table_name='tb_Area' and table_type='BASE') then 
Drop table dbo. Tb_Area
end if;


Here, tb_Area is my name to name the data table, consult the select 1 from sys. Systable what meaning be?

It is an error when executing the SQL file I should how to find the problem?

CodePudding user response:

SQL file generated by the PD16 code below

/*==============================================================*/
/* DBMS name: New DBMS */
/* Created on: 2016/3/9 20:03:14 */
/*==============================================================*/


If the exists (select 1 from sys. Systable where table_name='tb_Area' and table_type='BASE') then
Drop table dbo. Tb_Area
end if;

If the exists (select 1 from sys. Systable where table_name='tb_City' and table_type='BASE') then
Drop table dbo. Tb_City
end if;

If the exists (select 1 from sys. Systable where table_name='tb_Controller' and table_type='BASE') then
Drop table dbo. Tb_Controller
end if;

If the exists (select 1 from sys. Systable where table_name='tb_Intersection' and table_type='BASE') then
Drop table dbo. Tb_Intersection
end if;

If the exists (select 1 from sys. Systable where table_name='tb_IntersectionPeriodPhase' and table_type='BASE') then
Drop table dbo. Tb_IntersectionPeriodPhase
end if;

If the exists (select 1 from sys. Systable where table_name='tb_PhaseConflict' and table_type='BASE') then
Drop table dbo. Tb_PhaseConflict
end if;

If the exists (select 1 from sys. Systable where table_name='tb_PhasesDetail' and table_type='BASE') then
Drop table dbo. Tb_PhasesDetail
end if;

If the exists (select 1 from sys. Systable where table_name='tb_SubArea' and table_type='BASE') then
Drop table dbo. Tb_SubArea
end if;

/*==============================================================*/
/* User: dbo */
/*==============================================================*/
/*==============================================================*/
/* Table: tb_Area */
/*==============================================================*/
The create table dbo. Tb_Area (
AreaID int the not null,
AreaName varchar,
CityID int the not null
);

/*==============================================================*/
/* Table: tb_City */
/*==============================================================*/
The create table dbo. Tb_City (
CityID int the not null default '(1000),
CityName varchar default 'undefined'
);

/*==============================================================*/
/* Table: tb_Controller */
/*==============================================================*/
The create table dbo. Tb_Controller (
ControllerID int the not null,
ControllerName varchar not null default '22 new source controller,
22 ControllerType varchar not null default 'controller'
);

/*==============================================================*/
/* Table: tb_Intersection */
/*==============================================================*/
The create table dbo. Tb_Intersection (
IntersectionID int the not null default '(0),
IntersectionName varchar not null default 'pending',
StreetNameEW varchar not null default 'pending',
StreetNameSN varchar not null default 'pending',
SubAreaID int the not null default '(0),
LampEWType varchar not null,
LampSNType varchar not null,
LaneNumberEW int the not null,
LaneNumberSN int the not null,
ControllerID int the not null default '(0),
Position1X int the not null default '(0),
Position1Y int the not null default '(0),
Position2X int the not null default '(0),
Position2Y int the not null default '(0),
Position3X int the not null default '(0),
Position3Y int the not null default '(0),
Position4X int the not null default '(0),
Position4Y int the not null default '(0)'
);

/*==============================================================*/
/* Table: tb_IntersectionPeriodPhase */
/*==============================================================*/
The create table dbo. Tb_IntersectionPeriodPhase (
TotalPeriodPhaseID int the not null default '(10),
IntersectionID int the not null default '(0),
InterPeriodPhaseNo int the not null default '(1),
PhasesNumber int the not null default '(4)
);

/*==============================================================*/
/* Table: tb_PhaseConflict */
/*==============================================================*/
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related