各位大侠们:
你们好,我用POWERDESIGNER12.0 生成SQL语句后到SQL SERVER2005中执行,提示出错误:
消息 156,级别 15,状态 1,第 7 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 9 行
关键字 'delete' 附近有语法错误。
消息 156,级别 15,状态 1,第 12 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 14 行
关键字 'delete' 附近有语法错误。
消息 156,级别 15,状态 1,第 22 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 24 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 31 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 33 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 40 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 42 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 49 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 51 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 58 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 60 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 66 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 68 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 74 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 76 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 82 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 84 行
关键字 'if' 附近有语法错误。
消息 102,级别 15,状态 1,第 94 行
'varchar' 附近有语法错误。
SQL语句是:
/*==============================================================*/
/* DBMS name: Sybase AS Anywhere 9 */
/* Created on: 2010-1-18 9:47:06 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_TOTAL_RELATIONS_CUSTOMER') then
alter table total
delete foreign key FK_TOTAL_RELATIONS_CUSTOMER
end if;if exists(select 1 from sys.sysforeignkey where role='FK_TOTAL_RELATIONS_COMMODIT') then
alter table total
delete foreign key FK_TOTAL_RELATIONS_COMMODIT
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='commodity_PK'
and t.table_name='commodity'
) then
drop index commodity.commodity_PK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='customer_PK'
and t.table_name='customer'
) then
drop index customer.customer_PK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='Relationship_1_FK'
and t.table_name='total'
) then
drop index total.Relationship_1_FK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='Relationship_2_FK'
and t.table_name='total'
) then
drop index total.Relationship_2_FK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='total_PK'
and t.table_name='total'
) then
drop index total.total_PK
end if;if exists(
select 1 from sys.systable
where table_name='commodity'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table commodity
end if;if exists(
select 1 from sys.systable
where table_name='customer'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table customer
end if;if exists(
select 1 from sys.systable
where table_name='total'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table total
end if;/*==============================================================*/
/* Table: commodity */
/*==============================================================*/
create table commodity
(
comm_num varchar(10) not null,
comm_name varchar(11),
comm_price integer,
comm_intro long varchar,
constraint PK_COMMODITY primary key (comm_num)
);/*==============================================================*/
/* Index: commodity_PK */
/*==============================================================*/
create unique index commodity_PK on commodity (
comm_num ASC
);/*==============================================================*/
/* Table: customer */
/*==============================================================*/
create table customer
(
cus_num varchar(10) not null,
cus_name varchar(20),
cus_phone varchar(11),
cus_address varchar(50),
cus_email varchar(15),
constraint PK_CUSTOMER primary key (cus_num)
);/*==============================================================*/
/* Index: customer_PK */
/*==============================================================*/
create unique index customer_PK on customer (
cus_num ASC
);/*==============================================================*/
/* Table: total */
/*==============================================================*/
create table total
(
cus_num varchar(10) not null,
comm_num varchar(10) not null,
total_price integer,
total_number integer,
constraint PK_TOTAL primary key clustered (cus_num, comm_num)
);/*==============================================================*/
/* Index: total_PK */
/*==============================================================*/
create unique index total_PK on total (
cus_num ASC,
comm_num ASC
);/*==============================================================*/
/* Index: Relationship_1_FK */
/*==============================================================*/
create index Relationship_1_FK on total (
cus_num ASC
);/*==============================================================*/
/* Index: Relationship_2_FK */
/*==============================================================*/
create index Relationship_2_FK on total (
comm_num ASC
);alter table total
add constraint FK_TOTAL_RELATIONS_CUSTOMER foreign key (cus_num)
references customer (cus_num)
on update cascade
on delete cascade;alter table total
add constraint FK_TOTAL_RELATIONS_COMMODIT foreign key (comm_num)
references commodity (comm_num)
on update cascade
on delete cascade;
请你们帮我解决下啊!
你们好,我用POWERDESIGNER12.0 生成SQL语句后到SQL SERVER2005中执行,提示出错误:
消息 156,级别 15,状态 1,第 7 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 9 行
关键字 'delete' 附近有语法错误。
消息 156,级别 15,状态 1,第 12 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 14 行
关键字 'delete' 附近有语法错误。
消息 156,级别 15,状态 1,第 22 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 24 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 31 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 33 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 40 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 42 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 49 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 51 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 58 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 60 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 66 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 68 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 74 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 76 行
关键字 'if' 附近有语法错误。
消息 156,级别 15,状态 1,第 82 行
关键字 'then' 附近有语法错误。
消息 156,级别 15,状态 1,第 84 行
关键字 'if' 附近有语法错误。
消息 102,级别 15,状态 1,第 94 行
'varchar' 附近有语法错误。
SQL语句是:
/*==============================================================*/
/* DBMS name: Sybase AS Anywhere 9 */
/* Created on: 2010-1-18 9:47:06 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_TOTAL_RELATIONS_CUSTOMER') then
alter table total
delete foreign key FK_TOTAL_RELATIONS_CUSTOMER
end if;if exists(select 1 from sys.sysforeignkey where role='FK_TOTAL_RELATIONS_COMMODIT') then
alter table total
delete foreign key FK_TOTAL_RELATIONS_COMMODIT
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='commodity_PK'
and t.table_name='commodity'
) then
drop index commodity.commodity_PK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='customer_PK'
and t.table_name='customer'
) then
drop index customer.customer_PK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='Relationship_1_FK'
and t.table_name='total'
) then
drop index total.Relationship_1_FK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='Relationship_2_FK'
and t.table_name='total'
) then
drop index total.Relationship_2_FK
end if;if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='total_PK'
and t.table_name='total'
) then
drop index total.total_PK
end if;if exists(
select 1 from sys.systable
where table_name='commodity'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table commodity
end if;if exists(
select 1 from sys.systable
where table_name='customer'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table customer
end if;if exists(
select 1 from sys.systable
where table_name='total'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table total
end if;/*==============================================================*/
/* Table: commodity */
/*==============================================================*/
create table commodity
(
comm_num varchar(10) not null,
comm_name varchar(11),
comm_price integer,
comm_intro long varchar,
constraint PK_COMMODITY primary key (comm_num)
);/*==============================================================*/
/* Index: commodity_PK */
/*==============================================================*/
create unique index commodity_PK on commodity (
comm_num ASC
);/*==============================================================*/
/* Table: customer */
/*==============================================================*/
create table customer
(
cus_num varchar(10) not null,
cus_name varchar(20),
cus_phone varchar(11),
cus_address varchar(50),
cus_email varchar(15),
constraint PK_CUSTOMER primary key (cus_num)
);/*==============================================================*/
/* Index: customer_PK */
/*==============================================================*/
create unique index customer_PK on customer (
cus_num ASC
);/*==============================================================*/
/* Table: total */
/*==============================================================*/
create table total
(
cus_num varchar(10) not null,
comm_num varchar(10) not null,
total_price integer,
total_number integer,
constraint PK_TOTAL primary key clustered (cus_num, comm_num)
);/*==============================================================*/
/* Index: total_PK */
/*==============================================================*/
create unique index total_PK on total (
cus_num ASC,
comm_num ASC
);/*==============================================================*/
/* Index: Relationship_1_FK */
/*==============================================================*/
create index Relationship_1_FK on total (
cus_num ASC
);/*==============================================================*/
/* Index: Relationship_2_FK */
/*==============================================================*/
create index Relationship_2_FK on total (
comm_num ASC
);alter table total
add constraint FK_TOTAL_RELATIONS_CUSTOMER foreign key (cus_num)
references customer (cus_num)
on update cascade
on delete cascade;alter table total
add constraint FK_TOTAL_RELATIONS_COMMODIT foreign key (comm_num)
references commodity (comm_num)
on update cascade
on delete cascade;
请你们帮我解决下啊!
解决方案 »
- Java 页面中实现多国语言切换功能_求助
- .jsp网页能否实现查询结果自动保存到EXECL文件?
- 登录后页面的自动跳转
- if (str==null && str.equals("")) 用<c:if>怎么写
- jsp页面的传值问题
- 有关FormFile
- request.getRequestDispatcher(url).forward(request,response)中的url不能使用绝对地址
- javascript中调用javabean与javabean中调用javascript
- 如何访问WEB-INF下的jsp文件?
- spring bean的问题
- 本人想去外包工作,各位能不能给点面试题
- 编译错误
数据库有
Sybase mysql oracle sqlserver db2
DBMS name: Sybase AS Anywhere 9
那你的数据库就是Sybase AS Anywhere 9
Oracle varchar2