close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
如何從64位元的SQL SERVER撈資料?
Jan 20th 2015, 07:15

我在32位元的SQL SERVER 2000, 可以設batch執行sql, 將資料撈出來. 程式就像下面這樣, 可把SQL server的資料撈到excel內.

缺件表.bat 的內容:
osql -S10.12.2.5 -E -dENTEE -w132 -i 缺件表.sql -o 缺件表.txt

缺件表.sql 的內容:
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\缺件表.xls', 'SELECT * FROM [資料$]') select * from jensu

然後資料就會到缺件表.xls內.

==============================

但現在換主機為 windows server 2012 R2+SQL SERVER 2012, 64位元. 就不行了. 我也安裝了 AccessDatabaseEngine_X64.exe ,

但是缺件表.SQL內容改為以下:
sp_configure 'ad hoc distributed queries', 1;
RECONFIGURE;
GO
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\tools\缺件表.xls', 'SELECT * FROM [資料$]') select * from jensu
go
sp_configure 'ad hoc distributed queries', 0
RECONFIGURE
GO

就會得到錯誤訊息:
訊息 7302,層級 16,狀態 1,伺服器 APSERVER,行 1
無法建立連結伺服器 "(null)" 的 OLE DB 提供者 "Microsoft.Jet.OLEDB.4.0" 的執行個體。

==============================

我想請問:
1.
我還有什麼部份少做了, 以至於連結不成?
2.
如果真的無法連結, 是否有辦法, 能將我寫好的sql放在其他位置自動執行, 定時跑出我需要的資料?

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 nbvo4o2861kqd 的頭像
    nbvo4o2861kqd

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

    nbvo4o2861kqd 發表在 痞客邦 留言(0) 人氣()