目前sql 2005不能使用opendatasouce這個函數?有人說是版本問題:
我裝的是sql 2005版本信息如下:
Microsoft SQL Server Management Studio      9.00.1399.00
Microsoft Analysis Services Client Tools      2005.090.1399.00
Microsoft Data Access Components (MDAC)      2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML      2.6 3.0 5.0 6.0 
Microsoft Internet Explorer      6.0.2900.2180
Microsoft .NET Framework      2.0.50727.42
Operating System      5.1.2600請問該如何升級能使用這個函數?
謝謝!!

解决方案 »

  1.   

    opendatasouce?说说你要做什么吧?
      

  2.   

    我運行
     SELECT   *   FROM   OpenDataSource('Microsoft.Jet.OLEDB.4.0',  
     'Data   Source="D:\hands\HAL3031707152.xls";Extended   
    properties=Excel   5.0')...Sheet1$ 提示:
    SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online. 
      

  3.   

    哦,用oledb不是可以把excel读到datatable中吗?
      

  4.   

    哦,可以完全不用你这种方式。
    你这种方法是sql server 的数据库链接功能吧 你要先在sql server 中链接好才能通过这句话来查询sql server 2000种好用的2005中没有用过
      

  5.   

    我是想在sql中直接存入datatable的,不是在代碼中
      

  6.   

    没有enable,
    sp_configure 'Ad Hoc Distributed Queries',1
      

  7.   

    先在查询分析器运行:
    EXEC sp_configure 'show advanced options', 1;
    GO
    RECONFIGURE;
    GO
    EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
    GO
    RECONFIGURE;
    GO然后再用opendatasouce