設計好物理資料模型、匯出sql陳述句后,在匯出的檔案中看到以下陳述句,
if exists(select 1 from sys.systable where table_name='tb_Area' and table_type='BASE') then
drop table dbo.tb_Area
end if;
這里,tb_Area是我給資料表起的名稱。請教select 1 from sys.systable是什么意思?
另外在執行這個SQL檔案時也報錯。我應該怎樣查找問題?
uj5u.com熱心網友回復:
由PD16生成的sql檔案代碼如下/*==============================================================*/
/* DBMS name: New DBMS */
/* Created on: 2016/3/9 20:03:14 */
/*==============================================================*/
if exists(select 1 from sys.systable where table_name='tb_Area' and table_type='BASE') then
drop table dbo.tb_Area
end if;
if exists(select 1 from sys.systable where table_name='tb_City' and table_type='BASE') then
drop table dbo.tb_City
end if;
if exists(select 1 from sys.systable where table_name='tb_Controller' and table_type='BASE') then
drop table dbo.tb_Controller
end if;
if exists(select 1 from sys.systable where table_name='tb_Intersection' and table_type='BASE') then
drop table dbo.tb_Intersection
end if;
if exists(select 1 from sys.systable where table_name='tb_IntersectionPeriodPhase' and table_type='BASE') then
drop table dbo.tb_IntersectionPeriodPhase
end if;
if exists(select 1 from sys.systable where table_name='tb_PhaseConflict' and table_type='BASE') then
drop table dbo.tb_PhaseConflict
end if;
if exists(select 1 from sys.systable where table_name='tb_PhasesDetail' and table_type='BASE') then
drop table dbo.tb_PhasesDetail
end if;
if 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 */
/*==============================================================*/
create table dbo.tb_Area (
AreaID int not null,
AreaName varchar,
CityID int not null
);
/*==============================================================*/
/* Table: tb_City */
/*==============================================================*/
create table dbo.tb_City (
CityID int not null default '(1000)',
CityName varchar default '未定義'
);
/*==============================================================*/
/* Table: tb_Controller */
/*==============================================================*/
create table dbo.tb_Controller (
ControllerID int not null,
ControllerName varchar not null default '新源22路控制器',
ControllerType varchar not null default '22路控制器'
);
/*==============================================================*/
/* Table: tb_Intersection */
/*==============================================================*/
create table dbo.tb_Intersection (
IntersectionID int not null default '(0)',
IntersectionName varchar not null default '未定',
StreetNameEW varchar not null default '未定',
StreetNameSN varchar not null default '未定',
SubAreaID int not null default '(0)',
LampEWType varchar not null,
LampSNType varchar not null,
LaneNumberEW int not null,
LaneNumberSN int not null,
ControllerID int not null default '(0)',
Position1X int not null default '(0)',
Position1Y int not null default '(0)',
Position2X int not null default '(0)',
Position2Y int not null default '(0)',
Position3X int not null default '(0)',
Position3Y int not null default '(0)',
Position4X int not null default '(0)',
Position4Y int not null default '(0)'
);
/*==============================================================*/
/* Table: tb_IntersectionPeriodPhase */
/*==============================================================*/
create table dbo.tb_IntersectionPeriodPhase (
TotalPeriodPhaseID int not null default '(10)',
IntersectionID int not null default '(0)',
InterPeriodPhaseNo int not null default '(1)',
PhasesNumber int not null default '(4)'
);
/*==============================================================*/
/* Table: tb_PhaseConflict */
/*==============================================================*/
create table dbo.tb_PhaseConflict (
ID int not null,
IntersectionID int not null default '(0)',
"Rows" int not null default '(0)',
LampName varchar,
EL varchar not null default 'R',
ET varchar not null default 'R',
ER varchar not null default 'R',
SL varchar not null default 'R',
ST varchar not null default 'R',
SR varchar not null default 'R',
WL varchar not null default 'R',
WT varchar not null default 'R',
WR varchar not null default 'R',
NL varchar not null default 'R',
NT varchar not null default 'R',
NR varchar not null default 'R',
EW varchar not null default 'R',
SW varchar not null default 'R',
WW varchar not null default 'R',
NW varchar not null default 'R'
);
/*==============================================================*/
/* Table: tb_PhasesDetail */
/*==============================================================*/
create table dbo.tb_PhasesDetail (
TotalPhaseID int not null,
TotalPeriodPhaseID int not null,
PhaseNo int not null default '(0)',
PhaseTime_Isolate int not null default '(20)',
PhaseTime_FlexiLink int not null default '(20)',
LampEL varchar not null default 'C',
LampET varchar not null default 'C',
LampER varchar not null default 'C',
LampEP1 varchar not null default 'C',
LampEP2 varchar not null default 'C',
LampSL varchar not null default 'C',
LampST varchar not null default 'C',
LampSR varchar not null default 'C',
LampSP1 varchar not null default 'C',
LampSP2 varchar not null default 'C',
LampWL varchar not null default 'C',
LampWT varchar not null default 'C',
LampWR varchar not null default 'C',
LampWP1 varchar not null default 'C',
LampWP2 varchar not null default 'C',
LampNL varchar not null default 'C',
LampNT varchar not null default 'C',
LampNR varchar not null default 'C',
LampNP1 varchar not null default 'C',
LampNP2 varchar not null default 'C'
);
/*==============================================================*/
/* Table: tb_SubArea */
/*==============================================================*/
create table dbo.tb_SubArea (
SubAreaID int not null,
SubAreaName varchar default '待定',
AreaID int not null default '(0)'
);
uj5u.com熱心網友回復:
在PD16中,運行sql檔案報錯如下圖所示。
uj5u.com熱心網友回復:
已知select 1 from == select * from
那么這里的sys.systable是指哪個?
在檔案夾中搜索“sys.systable”,沒有找到它。
uj5u.com熱心網友回復:
系統表,就看表tb_area 是否存在,是就洗掉,再創建uj5u.com熱心網友回復:
產生的是Sybase SQL anywhere資料庫的SQL,連接SQL Server資料庫執行?uj5u.com熱心網友回復:
這個查詢的意思是判斷你的資料庫中是否有這個表,如果有就洗掉;說有語法錯誤的原因可能是你的connection configure有問題,可以貼出來看看
uj5u.com熱心網友回復:
樓上完全正解轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/21342.html
標籤:數據庫相關
