CREATE TABLE Vet
(
VET_NUM CHAR(2) PRIMARY KEY,
LAST_NAME CHAR(15),
FIRST_NAME CHAR(15),
STREET CHAR(15),
CITY CHAR(15),
STATE CHAR(3),
POSTAL_CODE CHAR(5),
SALARY DECIMAL(7,2),
DEGREE CHAR(10),
POSITION CHAR(15)
);
INSERT INTO Vet (VET_NUM, LAST_NAME, FIRST_NAME, STREET, CITY, STATE, POSTAL_CODE, SALARY, DEGREE, POSITION)
VALUES ('1', 'Skechley', 'Cristine', '24340 7th Plaza', 'Pittsburgh', 'PA', '15274', 88053.30, 'Masters', 'Vet'),
('2', 'Fishpoole', 'Sig', '06784 Anthes Point', 'Philadelphia', 'PA', '19184', 45525.56, 'Associates', 'Receptionist'),
('3', 'Stother', 'Rycca', '04304 Superior Hill', 'Allentown', 'PA', '18105', 90553.37, 'Masters', 'Vet'),
('4', 'Scandrite', 'Kerrill', '30320 Express Crossing', 'Harrisburg', 'PA', '17126', 102553.59, 'Doctorates', 'Vet'),
('5', 'Glassman', 'Rhett', '33418 Tomscot Trail', 'Mc Keesport', 'PA', '15134', 56052.24, 'Bachelor', 'Management'),
('6', 'Gioan', 'Rab', '1 Pennsylvania Street', 'Hatfield', 'PA', '19440', 35880.76, 'Student', 'Janitor');
我一直得到的错误是
Ms 2627,Level 14,State 1,Line 35
违反PRIMARY KEY约束' PK__Vet__7C53690AE94CBCDD'
无法在对象' dbo.Vet'中插入重复键。重复键值为(1)。Msg 8152,Level 16,State 14,Line 38
字符串或二进制数据将被截断。Msg 8152,Level 16,State 14,Line 41
字符串或二进制数据将被截断。Msg 8152,Level 16,State 14,Line 44
字符串或二进制数据将被截断。
我不知道自己做错了什么。谁能帮我这个?我看过YouTube,我看过的视频说我输入的数据可能不太好。我认为我的数据没问题,但出于某种原因,我无法让它执行。我希望能够看到" Row已经受到影响"
答案 0 :(得分:0)
试试这个
{{1}}
列长度