[英]MSSQL insertWITHRELATIONSHIP
使用關系鍵在2個表中插入記錄時出現錯誤。 這是我的桌子:
表名稱為[tbl1]
Ccode bigint, (autoincrement) (not null) ----->relationship with tbl2
customerId varchar(5), (not null)
CUstomerName varchar(50)
表名是[tbl2]
User_Idx bigint, (autoincrement) (not null)
Ccode bigint, (autoincrement) (not null) ----->relationship with tbl1
callLogs bit, (yes/no or 0/1) (not null)
MyDateTime DateTime, (not null)
Duration smalldatetime,
Description varchar20
這是我的插入查詢,但沒有用:(
insert into tbl1 values ('5055','Vangelyn De Castro')
insert into tbl2 values ('1','01/26/16 08:40', '24:12:00','Incoming Call')
我認為這只是一個基本的架構問題。
帶有ccode的表2不應自動遞增,因為table1擁有ccode的唯一值。
table2 ccode bigint, (not null) -- that's it.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.