首页 > 代码库 > SQL大圣之路笔记——SQL 获取excel中的数据

SQL大圣之路笔记——SQL 获取excel中的数据

 1  select  2   --case (isnumeric(CMF_No)) when 1 then Convert(decimal(18,0),CMF_No)  3   --else Convert(nvarchar(255),CMF_No) end as CMF_No,Disti_Name, 4   --case (isnumeric(Disti_Invoice_Num)) when 1 then Convert(decimal(18,0),Disti_Invoice_Num) else ‘sss‘ end as Disti_Invoice_Num, 5   case  when len(Disti_Invoice_Num)<=1 then null when isnumeric(Disti_Invoice_Num) = 1 then Convert(decimal(18,0),Disti_Invoice_Num) else Convert(nvarchar(255),Disti_Invoice_Num) 6   end as Disti_Invoice_Num, 7   Disti_Invoice_Date,Scan_Date,Bar_Code,Product_Code, 8   case (isnumeric(Channel_GID_Num)) when 1 then Convert(decimal(18,0),Channel_GID_Num) else Convert(nvarchar(255),Channel_GID_Num) end as Channel_GID_Num, 9   Channel_Name,Channel_Address 10   11   from OpenDataSource (Microsoft.ACE.OLEDB.12.0,Data Source=C:\Inetpub\wwwroot\DataSynchronization\DownData\2016914164711677.xls;Extended properties=Excel 12.0)...[Sheet1$];

 

SQL大圣之路笔记——SQL 获取excel中的数据