存储过程代码如下,我查了又查,Excel表中的确有名为cnm的工作表
- SQL code
USE [人保]GO/****** Object: StoredProcedure [dbo].[SJ_JF_JGYL_DW] Script Date: 02/24/2012 22:07:55 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================ALTER PROCEDURE [dbo].[SJ_JF_JGYL_DW]@FileName char(500)='N:\__SJ_JF_JGYL_DW2005-2011单位应缴实缴明细2.xls'ASBEGIN--sj_zf_xnhdeclare @s nvarchar(max) -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here--truncate table SJ_DB_FFMXset @s='SELECT XZDM,XZQHDM,TCQDM,DWBH,FKSSQ,DZRQ_DW,ZJFS,JFLX,JFJE_DW_YJ,JFJE_DW_SJ,JFJE_DWHGR,JFJS_DW,JFBL_DW,JFRS_YJ,JFRS_SJ,DZBZ_DW 'set @[email protected]+' FROM OpenDataSource( ''Microsoft.Jet.OLEDB.4.0'','set @[email protected]+'''Data [email protected]+';User ID=Admin;Password=;Extended properties=Excel 5.0'') ...[cnm$]'execute(@s)set @s='insert __SJ_JF_JGYL_DW [email protected]execute(@s)END
出错如下:
消息 7314,级别 16,状态 1,第 1 行
链接服务器 "(null)" 的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 不包含表 "cnm$"。该表不存在,或者当前用户没有访问该表的权限。
------解决方案--------------------
你换个名字再试试呢?