導出數據為Excel:
EXEC master..xp_cmdshell
'bcp fsebss.dbo.Resource_GoodsType out c:\temp1.xls -c -q -S"YYSOFT-468ER27V(sql服務器名稱)"
-U"sa(登錄名)" -P"111111(密碼)"'
從Excel中導入數據:
insert into VPMN_BaseInforList_ML(BI_BaseShopNo,BIL_BaseShopListNo,BIL_Name,BIL_Jobs,BIL_Tel)
SELECT (left(成員編號,11)) '合作商編號',(left(成員編號,11)+right(成員編號,3)) '成員編號',姓名,職位,convert(varchar(50),手機號碼,120)
FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source="c:\pp.xls";
User ID=Admin;PassWord=;Extended propertIEs=Excel 8.0')...[sheet2$] where 姓名 is not null