免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1740 | 回复: 8
打印 上一主题 下一主题

急、急,利用sql文件建立数据表 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-07-27 08:43 |只看该作者 |倒序浏览
我的Sybase11.5中,利用sql文件建立数据表,怎么也建立不了,求助
!!!!!!!!     
不报错,执行命令书写为
isql -Usa -P <zmm.sql     

zmm.sql 为

/*管理(维护)类表*/
/*商品信息库*/
drop table G001;
create table G001
G00101        char(                         not null         //商品内码
G00102        varchar(40)                not null         //商品名称       
G00103        char(13)                        null                //商品条形码       
G00104        char(                         not null        //商品编码               
G00105        char(12)                         not null        //货号
G00106        varchar(60)                null                //规格
G00107        varchar(20)                null                //注册商标
G00108        char(1)                        not null        //生命标志
G01401        char(4)                        not null        //商品等级号
G00401         char(10)                        not null        //厂家代码
G01601        char(20)                        not null        //产地代码
G01301        char(6)                        null                //品牌代码
G00113        char(1)                        not null        //三信标志
G00114        float                         not null        //进货税率
G00115        float                         not null        //销货税率
G00116        float                         not null        //最低备货数
G00117        float                         not null        //最高备货数                       
G007011        char(3)                        not null        //品种大类码
G007012        char(3)                        not null        //营业类码
G05701        char(2)                        not null        //计量单位
G00121        char(1)                        not null        //危险品标记
G00122        char(                        not null        //色别                C        8               
G00123        varchar(16)                null                //简称        VC        16        NULL       
G00124        varchar(20)                null                //名优商品批号
G00125        int                                null          //保质期
G00126        int                                null          //包装数量(缺省)
) on mis_data;
create unique index G00101 on G001(G00101)        on mis_index;
create index G00103 on G001(G00103)        on mis_index;
create unique index G00104 on G001(G00104)        on mis_index;
exec sp_primarykey G001,G00101,G00104;
//exec sp_primarykey G001,G00104;

论坛徽章:
0
2 [报告]
发表于 2003-07-27 09:09 |只看该作者

急、急,利用sql文件建立数据表

你怎么做的
错误信息?

论坛徽章:
0
3 [报告]
发表于 2003-07-27 20:20 |只看该作者

急、急,利用sql文件建立数据表

有一种可能是zmm.sql 文件中没有写“go"命令;你的命令根本没有执行,所以连出错信息都没有!

论坛徽章:
0
4 [报告]
发表于 2003-07-28 06:06 |只看该作者

急、急,利用sql文件建立数据表

go 写在sql文件中什么位置

论坛徽章:
0
5 [报告]
发表于 2003-07-28 06:06 |只看该作者

急、急,利用sql文件建立数据表

go 写在sql文件中什么位置

论坛徽章:
0
6 [报告]
发表于 2003-07-28 09:31 |只看该作者

急、急,利用sql文件建立数据表

你最好把SQL也贴上来

论坛徽章:
0
7 [报告]
发表于 2003-07-28 11:48 |只看该作者

急、急,利用sql文件建立数据表

可以试试 isql  -Usa -P -i zmm.sql

注意文本中是否有 go
如果是在unix下,还要注意文本的格式,不要有 ^M

论坛徽章:
0
8 [报告]
发表于 2003-07-28 11:52 |只看该作者

急、急,利用sql文件建立数据表

把所有的 “; ” 替换成 “go”,并且 go 要另起一行     

单行的注释用 “--”,就是两个减号     

每行字段定义后要加 “,”


create table t (
a char( 3 ) not null,
b int  not null,
c char( 8 ) null,
constraint PK_t primary key (a,b)
)
go

论坛徽章:
0
9 [报告]
发表于 2003-07-29 16:01 |只看该作者

急、急,利用sql文件建立数据表

use  数据库名
go

drop table G001
go
create table G001
G00101 char( not null ,//商品内码
G00102 varchar(40) not null ,//商品名称
G00103 char(13) null ,//商品条形码
G00104 char( not null ,//商品编码
G00105 char(12) not null ,//货号
G00106 varchar(60) null, //规格
G00107 varchar(20) null ,//注册商标
G00108 char(1) not null ,//生命标志
G01401 char(4) not null ,//商品等级号
G00401 char(10) not null ,//厂家代码
G01601 char(20) not null ,//产地代码
G01301 char(6) null ,//品牌代码
G00113 char(1) not null ,//三信标志
G00114 float not null ,//进货税率
G00115 float not null ,//销货税率
G00116 float not null, //最低备货数
G00117 float not null ,//最高备货数
G007011 char(3) not null ,//品种大类码
G007012 char(3) not null, //营业类码
G05701 char(2) not null ,//计量单位
G00121 char(1) not null ,//危险品标记
G00122 char( not null ,//色别 C 8
G00123 varchar(16) null ,//简称 VC 16 NULL
G00124 varchar(20) null, //名优商品批号
G00125 int null ,//保质期
G00126 int null //包装数量(缺省)
) on mis_data
go

create unique index G00101 on G001(G00101) on mis_index
go
create index G00103 on G001(G00103) on mis_index
go
create unique index G00104 on G001(G00104) on mis_index
go
最后几行语句有问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP