既存のデータベースを phpmyadmin にアップロードしていますが、データを入力しようとするとこのエラーが発生します。
1064 - SQL 構文にエラーがあります。2 行目の 'IDENTITY, acct_num varchar(25) NULL, acct_des ' 付近で使用する正しい構文については、MySQL サーバーのバージョンに対応するマニュアルを確認してください。
私は phpmyadmin にかなり精通していますが、プログラマーではありません。入力しようとしているデータは次のとおりです。
CREATE TABLE t_acct (
acct_id int IDENTITY,
acct_num varchar(25) NULL,
acct_des varchar(50) NULL,
status tinyint NULL,
PRIMARY KEY (acct_id)
)
go
CREATE TABLE t_asset (
asset_id int IDENTITY,
fund_id int NULL,
acct_id int NULL,
emp_id int NULL,
chkloc_id int NULL,
cond_id int NULL,
type_id int NULL,
class_id int NULL,
storloc_id int NULL,
outdte datetime NULL,
duedte datetime NULL,
bcode char(20) NOT NULL,
notes varchar(255) NULL,
des char(100) NULL,
model varchar(30) NULL,
sn varchar(50) NULL,
recdte datetime NULL,
price real NULL,
curdte datetime NULL,
curval real NULL,
dep real NULL,
deptype tinyint NULL,
image varchar(255) NULL,
status tinyint NOT NULL DEFAULT 1,
bin tinyint NULL,
bin_qty real NULL,
wardte datetime NULL,
purch_from varchar(255) NULL,
consumable tinyint NULL,
salvage_val real NULL,
reord_pt real NULL,
PRIMARY KEY NONCLUSTERED (asset_id)
)
go
CREATE INDEX XIF20t_asset ON t_asset
(
acct_id
)
go
CREATE INDEX XIF21t_asset ON t_asset
(
fund_id
)
go
CREATE INDEX XIF4t_asset ON t_asset
(
class_id
)
go
CREATE INDEX XIF5t_asset ON t_asset
(
type_id
)
go
CREATE INDEX XIF6t_asset ON t_asset
(
cond_id
)
go
CREATE INDEX XIF7t_asset ON t_asset
(
chkloc_id
)
go
CREATE INDEX XIF8t_asset ON t_asset
(
storloc_id
)
go
CREATE INDEX XIF9t_asset ON t_asset
(
emp_id
)
go
CREATE INDEX status ON t_asset
(
status
)
go
CREATE INDEX bcode ON t_asset
(
bcode
)
go
CREATE INDEX wardte ON t_asset
(
wardte
)
go
CREATE TABLE t_audit (
audit_id int IDENTITY,
audit_name varchar(255) NULL,
dte datetime NULL,
status tinyint NULL,
PRIMARY KEY NONCLUSTERED (audit_id)
)
go
CREATE INDEX dte ON t_audit
(
dte
)
go
CREATE INDEX status ON t_audit
(
status
)
go
CREATE TABLE t_audititems (
audititems_id int NOT NULL,
audit_id int NULL,
chk tinyint NULL,
ubcode char(20) NULL,
user_id int NULL,
abcode char(20) NULL,
asset_id int NULL,
ebcode char(20) NULL,
emp_id int NULL,
lbcode char(20) NULL,
loc_id int NULL,
expemp_id int NULL,
exploc_id int NULL,
dte datetime NULL,
status tinyint NULL,
bin_qty real NULL,
rec_type varchar(1) NULL,
asset_status varchar(20) NULL,
audit_reason varchar(50) NULL,
clear_table tinyint NULL,
notes varchar(255) NULL
)
go
ALTER TABLE t_audititems
ADD FOREIGN KEY (audit_id)
REFERENCES t_audit
go
CREATE TABLE t_bctype (
bctype_id int IDENTITY,
bctype varchar(50) NULL,
fntname varchar(50) NULL,
PRIMARY KEY (bctype_id)
)
go
CREATE TABLE t_class (
class_id int IDENTITY,
class char(20) NOT NULL,
des varchar(80) NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (class_id)
)
go
CREATE UNIQUE INDEX class ON t_class
(
class
)
go
CREATE INDEX status ON t_class
(
status
)
go
CREATE TABLE t_cond (
cond_id int IDENTITY,
cond char(20) NOT NULL,
des varchar(80) NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (cond_id)
)
go
CREATE UNIQUE INDEX XAK1t_cond ON t_cond
(
cond
)
go
CREATE INDEX status ON t_cond
(
status
)
go
CREATE TABLE t_curr_conns (
curr_conns_id int IDENTITY,
comp_name char(50) NULL,
tme datetime NULL,
PRIMARY KEY (curr_conns_id)
)
go
CREATE TABLE t_docs (
doc_id int IDENTITY,
asset_id int NULL,
doc_name varchar(255) NULL,
PRIMARY KEY NONCLUSTERED (doc_id)
)
go
CREATE INDEX XIF26t_docs ON t_docs
(
asset_id
)
go
CREATE INDEX doc_name ON t_docs
(
doc_name
)
go
CREATE TABLE t_emp (
emp_id int IDENTITY,
lname char(30) NULL,
fname char(80) NULL,
mname char(1) NULL,
bcode char(20) NULL,
login char(10) NULL,
pass char(10) NULL,
phone varchar(20) NULL,
altphone varchar(20) NULL,
notes varchar(255) NULL,
status tinyint NOT NULL DEFAULT 1,
ass tinyint NOT NULL DEFAULT 0,
res tinyint NOT NULL DEFAULT 0,
chk tinyint NOT NULL DEFAULT 0,
sup tinyint NOT NULL DEFAULT 0,
f_use tinyint NOT NULL DEFAULT 0,
mem tinyint NULL,
mem_ident_num varchar(20) NULL,
email varchar(80) NULL,
addr varchar(255) NULL,
category tinyint NULL,
emp_mem tinyint NULL,
PRIMARY KEY NONCLUSTERED (emp_id)
)
go
CREATE UNIQUE INDEX bcode ON t_emp
(
bcode
)
go
CREATE INDEX login ON t_emp
(
login
)
go
CREATE INDEX fname ON t_emp
(
fname
)
go
CREATE INDEX lname ON t_emp
(
lname
)
go
CREATE INDEX status ON t_emp
(
status
)
go
CREATE INDEX mem_ident_num ON t_emp
(
mem_ident_num
)
go
CREATE TABLE t_fac (
fac_id int IDENTITY,
fac varchar(40) NULL,
address varchar(100) NULL,
city varchar(40) NULL,
state varchar(2) NULL,
zip varchar(10) NULL,
notes varchar(255) NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (fac_id)
)
go
CREATE UNIQUE INDEX fac ON t_fac
(
fac
)
go
CREATE INDEX status ON t_fac
(
status
)
go
CREATE TABLE t_fund (
fund_id int IDENTITY,
fund_des varchar(50) NULL,
status tinyint NULL,
PRIMARY KEY (fund_id)
)
go
CREATE TABLE t_hist (
hist_id int IDENTITY,
fund_id int NULL,
acct_id int NULL,
cond_id int NULL,
fromloc_id int NULL,
loc_id int NULL,
fromemp_id int NULL,
emp_id int NULL,
asset_id int NULL,
dte datetime NULL,
type varchar(30) NULL,
bin_qty real NULL,
user_name varchar(120) NULL,
notes varchar(255) NULL,
PRIMARY KEY NONCLUSTERED (hist_id)
)
go
CREATE INDEX XIF10t_hist ON t_hist
(
asset_id
)
go
CREATE INDEX XIF11t_hist ON t_hist
(
emp_id
)
go
CREATE INDEX XIF12t_hist ON t_hist
(
loc_id
)
go
CREATE INDEX XIF13t_hist ON t_hist
(
cond_id
)
go
CREATE INDEX XIF15t_hist ON t_hist
(
fromemp_id
)
go
CREATE INDEX XIF16t_hist ON t_hist
(
fromloc_id
)
go
CREATE INDEX XIF18t_hist ON t_hist
(
acct_id
)
go
CREATE INDEX XIF19t_hist ON t_hist
(
fund_id
)
go
CREATE INDEX dte ON t_hist
(
dte
)
go
CREATE TABLE t_lbldesign_type (
design_type_id int IDENTITY,
design_name varchar(30) NULL,
design_type varchar(30) NULL,
PRIMARY KEY (design_type_id)
)
go
CREATE TABLE t_lbldesign (
design_id int NULL,
ele_type char(20) NULL,
ele_top smallint NULL,
ele_left smallint NULL,
ele_ht smallint NULL,
ele_wid smallint NULL,
font_name varchar(50) NULL,
font_bold varchar(5) NULL,
font_ital varchar(5) NULL,
font_size float NULL,
text_caption varchar(50) NULL,
text_datafld_seq smallint NULL,
graphic_fname varchar(255) NULL
)
go
CREATE INDEX XIF14t_lbldesign ON t_lbldesign
(
design_id
)
go
CREATE TABLE t_lbldesign_hdr (
design_id int IDENTITY,
design_name char(50) NULL,
design_wid float NULL,
design_ht float NULL,
design_type char(30) NULL,
design_orient varchar(1) NULL,
print_orient varchar(11) NULL,
design_type_id int NULL,
PRIMARY KEY (design_id)
)
go
CREATE TABLE t_lblref (
design_type char(20) NULL,
seq_num smallint NULL,
db_field_name varchar(50) NULL,
descript varchar(30) NULL,
sample_data varchar(50) NULL,
design_type_id int NULL
)
go
CREATE TABLE t_loc (
loc_id int IDENTITY,
emp_id int NULL,
fac_id int NULL,
loc char(50) NOT NULL,
bcode char(20) NULL,
stor tinyint NOT NULL DEFAULT 0,
notes varchar(255) NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (loc_id)
)
go
CREATE UNIQUE INDEX bcode ON t_loc
(
bcode
)
go
CREATE INDEX XIF1t_loc ON t_loc
(
fac_id
)
go
CREATE INDEX XIF17t_loc ON t_loc
(
emp_id
)
go
CREATE INDEX status ON t_loc
(
status
)
go
CREATE INDEX stor ON t_loc
(
stor
)
go
CREATE INDEX loc ON t_loc
(
loc
)
go
CREATE TABLE t_misc (
aclass varchar(25) NULL,
atype varchar(25) NULL,
afac varchar(25) NULL,
aloc varchar(25) NULL,
adep tinyint NULL,
apurge tinyint NULL,
afund varchar(25) NULL,
image_folder varchar(255) NULL,
auditseq int NULL,
cust_ident varchar(4) NULL,
license_key varchar(16) NULL,
bc_prefix varchar(3) NULL,
bc_seqnum varchar(20) NULL,
relocate tinyint NULL,
arepair tinyint NULL,
app_ver varchar(20) NULL,
amaint_rpt tinyint NULL,
afindpop tinyint NULL,
amem varchar(25),
mem_show tinyint NULL,
cat1_nme varchar(25),
cat2_nme varchar(25),
cat3_nme varchar(25),
mem_fldnme1 varchar(25),
mem_fldnme2 varchar(25),
mem_fldnme3 varchar(25),
mem_fldnme4 varchar(25),
smtp_host varchar(50),
smtp_addr varchar(50),
smtp_user varchar(50),
smtp_pass varchar(20),
smtp_type tinyint NULL,
srv_int int,
amodnum varchar(25),
asernum varchar(25),
acond varchar(25),
report_folder varchar(255),
logo varchar(255),
display_emp tinyint NULL,
display_acct tinyint NULL,
semester_enddte datetime NULL,
frd varchar(10),
req_chkin tinyint NULL,
areord_rpt tinyint NULL,
adep_pref tinyint NULL
)
go
CREATE TABLE t_res (
res_id int IDENTITY,
asset_id int NULL,
emp_id int NULL,
loc_id int NULL,
fdte datetime NULL,
tdte datetime NULL,
notes varchar(80) NULL,
prio tinyint NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (res_id)
)
go
CREATE INDEX XIF2t_res ON t_res
(
emp_id
)
go
CREATE INDEX XIF3t_res ON t_res
(
asset_id
)
go
CREATE INDEX loc_id ON t_res
(
loc_id
)
go
CREATE INDEX fdte ON t_res
(
fdte
)
go
CREATE INDEX tdte ON t_res
(
tdte
)
go
CREATE TABLE t_type (
type_id int IDENTITY,
type char(20) NULL,
des varchar(80) NULL,
dep real NULL,
status tinyint NOT NULL DEFAULT 1,
class_id int NULL,
duedte_type tinyint NULL,
duedte_num_days smallint NULL,
PRIMARY KEY NONCLUSTERED (type_id)
)
go
CREATE INDEX type ON t_type
(
type
)
go
CREATE INDEX status ON t_type
(
status
)
go
CREATE TABLE t_user_defined_data (
user_data_id int IDENTITY,
asset_id int NULL,
user_field_id int NULL,
user_data varchar(255) NULL,
dte_entered datetime NULL,
PRIMARY KEY NONCLUSTERED (user_data_id)
)
go
CREATE INDEX XIF24t_user_defined_data ON t_user_defined_data
(
user_field_id
)
go
CREATE INDEX XIF25t_user_defined_data ON t_user_defined_data
(
asset_id
)
go
CREATE INDEX user_data ON t_user_defined_data
(
user_data
)
go
CREATE TABLE t_user_defined_field (
user_field_id int IDENTITY,
type_id int NULL,
class_id int NULL,
user_field_name varchar(50) NULL,
status tinyint NULL,
PRIMARY KEY NONCLUSTERED (user_field_id)
)
go
CREATE INDEX XIF22t_user_defined_field ON t_user_defined_field
(
class_id
)
go
CREATE INDEX XIF23t_user_defined_field ON t_user_defined_field
(
type_id
)
go
CREATE INDEX user_field_name ON t_user_defined_field
(
user_field_name
)
go
ALTER TABLE t_asset
ADD FOREIGN KEY (fund_id)
REFERENCES t_fund
go
ALTER TABLE t_asset
ADD FOREIGN KEY (acct_id)
REFERENCES t_acct
go
ALTER TABLE t_asset
ADD FOREIGN KEY (emp_id)
REFERENCES t_emp
go
ALTER TABLE t_asset
ADD FOREIGN KEY (storloc_id)
REFERENCES t_loc
go
ALTER TABLE t_asset
ADD FOREIGN KEY (chkloc_id)
REFERENCES t_loc
go
ALTER TABLE t_asset
ADD FOREIGN KEY (cond_id)
REFERENCES t_cond
go
ALTER TABLE t_asset
ADD FOREIGN KEY (type_id)
REFERENCES t_type
go
ALTER TABLE t_asset
ADD FOREIGN KEY (class_id)
REFERENCES t_class
go
ALTER TABLE t_docs
ADD FOREIGN KEY (asset_id)
REFERENCES t_asset
go
ALTER TABLE t_hist
ADD FOREIGN KEY (fund_id)
REFERENCES t_fund
go
ALTER TABLE t_hist
ADD FOREIGN KEY (acct_id)
REFERENCES t_acct
go
ALTER TABLE t_hist
ADD FOREIGN KEY (fromloc_id)
REFERENCES t_loc
go
ALTER TABLE t_hist
ADD FOREIGN KEY (fromemp_id)
REFERENCES t_emp
go
ALTER TABLE t_hist
ADD FOREIGN KEY (cond_id)
REFERENCES t_cond
go
ALTER TABLE t_hist
ADD FOREIGN KEY (loc_id)
REFERENCES t_loc
go
ALTER TABLE t_hist
ADD FOREIGN KEY (emp_id)
REFERENCES t_emp
go
ALTER TABLE t_hist
ADD FOREIGN KEY (asset_id)
REFERENCES t_asset
go
ALTER TABLE t_lbldesign
ADD FOREIGN KEY (design_id)
REFERENCES t_lbldesign_hdr
go
ALTER TABLE t_loc
ADD FOREIGN KEY (emp_id)
REFERENCES t_emp
go
ALTER TABLE t_loc
ADD FOREIGN KEY (fac_id)
REFERENCES t_fac
go
ALTER TABLE t_res
ADD FOREIGN KEY (asset_id)
REFERENCES t_asset
go
ALTER TABLE t_res
ADD FOREIGN KEY (emp_id)
REFERENCES t_emp
go
ALTER TABLE t_user_defined_data
ADD FOREIGN KEY (asset_id)
REFERENCES t_asset
go
ALTER TABLE t_user_defined_data
ADD FOREIGN KEY (user_field_id)
REFERENCES t_user_defined_field
go
ALTER TABLE t_user_defined_field
ADD FOREIGN KEY (type_id)
REFERENCES t_type
go
ALTER TABLE t_user_defined_field
ADD FOREIGN KEY (class_id)
REFERENCES t_class
go
CREATE TABLE t_prov (
prov_id int IDENTITY,
prov_des varchar(50) NULL,
address varchar(100) NULL,
city varchar(40) NULL,
state varchar(2) NULL,
zip varchar(10) NULL,
notes varchar(255) NULL,
contact varchar(100) NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (prov_id)
)
go
CREATE INDEX prov_des ON t_prov
(
prov_des
)
go
CREATE INDEX status ON t_prov
(
status
)
go
CREATE TABLE t_maint (
maint_id int IDENTITY,
type_id int NULL,
class_id int NULL,
maint_name varchar(50) NULL,
spec_inst varchar(255) NULL,
m_interval real NULL,
status tinyint NOT NULL DEFAULT 1,
PRIMARY KEY NONCLUSTERED (maint_id)
)
go