注意的一點時加個newid字段,以記錄使每一次導入都不同,可恢復之類的操作
DECLARE @nid varchar(50)
DECLARE @dt datetime
SET @nid = newid()
SET @dt = getdate()
INSERT INTO CustomerTemp
SELECT 'zhuyunbo' AS Developer, 銷售部門 AS DepartmentName, 日期 AS ReceiveDate,
工號 AS WorkNo, 顧問姓名 AS SalesStaffName, 客戶姓名 AS CustomerName, 地址 AS Address,
聯系電話 AS Tel, 性別 AS Sex, 身高體重年齡 AS Height_Weight_Age,
客戶狀態 AS CustomerStatus, 溝通記錄 AS Record1,
F12 AS Record2,
NULL AS Record3,
@dt AS ImportDate,
@nid As nd
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 'Data Source= "G:\發展部數據資料\發展部祝雲波資料.xls";Extended Properties= "Excel 5.0;HDR=YES;Excel 8.0";Persist Security Info=False ')...[客戶資料庫$]
print @nid
print @dt