SQL的问题 - INSERT INTO

时间:2018-05-21 15:41:46

标签: sql-server

CREATE TABLE Customer
(
    CustomerID BIGINT IDENTITY(1,1) PRIMARY KEY NOT NULL,
    OrganizationName VARCHAR(255) NOT NULL,
    Telephone VARCHAR(255),
    MobileTelephone VARCHAR(255) NOT NULL,
    CustomerAdressLine1 VARCHAR(255) NOT NULL,
    CustomerAdressLine2 VARCHAR(255),
    PostalCode VARCHAR(255) NOT NULL,
    FederalTaxID VARCHAR(255) UNIQUE NOT NULL,
    EmailAddress VARCHAR(255) UNIQUE NOT NULL,
    SageCustomerID BIGINT UNIQUE
);

INSERT INTO Customer (OrganizationName, Telephone,  MobileTelephone, CustomerAdressLine1, CustomerAdressLine2, PostalCode, FederalTaxID, EmailAddress,  SageCustomerId) *
VALUES ('OrganizationName1', 'Telephone1', 'MobileTelephone1', 'CustomerAdressLine1', 'CustomerAdressLine2', 'PostalCode1', 'FederalTaxID1', 'EmailAddress1', 'SageCustomerId1'),
       ('OrganizationName2', 'Telephone2', 'MobileTelephone2', 'CustomerAdressLine2', 'CustomerAdressLine2', 'PostalCode2', 'FederalTaxID2', 'EmailAddress2', 'SageCustomerId2'),
       ('OrganizationName3', 'Telephone3', 'MobileTelephone3', 'CustomerAdressLine3', 'CustomerAdressLine3', 'PostalCode3', 'FederalTaxID3', 'EmailAddress3', 'SageCustomerId3');

我收到此错误:

  

Msg 8114,Level 16,State 5,Line 1
  将数据类型varchar转换为bigint时出错。

我的代码中的错误是什么?

1 个答案:

答案 0 :(得分:4)

' SageCustomerId1'不是有效的BIGINT值。