我有一组记录,我将这些记录批量插入到包含5列和附加列的表中。我想将AdmissionUsed设置为默认值0,但仍然可以从.csv文件中插入所需的记录。
我怎样才能完成这个?
BULK INSERT PatientAdmissions
FROM 'xyz.csv'
WITH (
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
);
GO
CREATE TABLE PatientAdmissions
(NationalHealthIndex INT NOT NULL,
Gender VARCHAR (1) NOT NULL
CONSTRAINT CHK_gender_check CHECK(Gender= 'M' Or Gender = 'F' ),
AdmissionDate DATE NOT NULL,
AdmissionType VARCHAR (20) NOT NULL,
TreatmentType VARCHAR (20) NOT NULL,
AdmissionUsed Int Null DEFAULT(0),
);